/* common */
(function (a) {
    if (a[a.length - 1] === ".") return;
    var b = a.split("."),
        c = b.length;
    c >= 2 && (document.domain = b[c - 2] + "." + b[c - 1])
})(document.domain);

function objectify(a) {
    var b = a[0].attributes,
        c, d = {};
    for (var e = 0, f = b.length; e < f; e++) c = b[e].name, c.indexOf("data-") === 0 && (c = c.substring(5), d[$.camelCase(c)] = a.data(c));
    return d
}
function attributify(a, b) {
    var c = "";
    for (var d in a) {
        if (!a.hasOwnProperty(d)) continue;
        if (!(typeof a[d] != "object" || a[d] instanceof Array)) {
            c += arguments.callee(a[d], d);
            continue
        }
        if (a[d] === undefined) continue;

        function e(a) {
            return String(a).replace(/&(?!\w+;)/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;")
        }
        function f(a) {
            return a.replace(/\W+/g, "-").replace(/([a-z\d])([A-Z])/g, "$1-$2")
        }
        c += (c || b ? " " : "") + "data-" + f((b ? b + "-" : "") + d) + '="' + (a[d] instanceof Array ? a[d].join(",") : e(a[d])) + '"'
    }
    return c
}
function seofy(a) {
    return a.replace(/[^a-zA-Z0-9_.]/gi, " ").replace(/\s+/g, "-").toLowerCase()
}
var handlerPath = /ajax\//i;
jQuery.ajaxSettings.beforeSend = function (a, b) {
    if (!handlerPath.test(b.url) && !b.type === "POST") return;
    context.hashMashter && a.setRequestHeader("Hash", context.hashMashter), context.profilerLevel && a.setRequestHeader("X-Profiler-Level", context.profilerLevel);
    var c = context.lastInfluencer != null ? context.lastInfluencer : sessionStorage.influencer;
    c && a.setRequestHeader("X-Influencer", c), context.lastInfluencer = null
}, Date.prototype.addDays = function (a) {
    return this.setDate(this.getDate() + a), this
}, jQuery.extend(String.prototype, {
    trimEnd: function () {
        return this.replace(/\s+$/, "")
    },
    trimStart: function () {
        return this.replace(/^\s+/, "")
    },
    endsWith: function (a) {
        return this.substr(this.length - a.length) === a
    },
    startsWith: function (a) {
        return this.substr(0, a.length) === a
    },
    parseNameValuePair: function (a, b) {
        a || (a = "=");
        if (this[0] === a) return null;
        var c, d = this.search(a);
        return d > 0 ? c = {
            name: this.substring(0, d),
            value: this.substring(d + 1)
        } : c = {
            name: this,
            value: ""
        }, b && (c = b(c)), c
    },
    parseNameValuePairs: function (a, b, c) {
        var d = {}, e = null,
            f = this.split(a || "&");
        for (var g = 0; g < f.length; g++) {
            e = f[g].parseNameValuePair(b, c);
            if (!e) continue;
            d[e.name] = e.value
        }
        return d
    },
    format: function () {
        var a = arguments;
        return this.replace(/\{(\d+)\}/g, function (b, c) {
            return a[c]
        })
    }
}), String.prototype.trim || (String.prototype.trim = function () {
    return jQuery.trim(this)
}), Object.fromQueryString = function (a) {
    return a.replace(/\+/g, " ").parseNameValuePairs("&", "=", function (a) {
        return a.value = decodeURIComponent(a.value), a
    })
}, String.prototype.parse = function () {
    var a = String(this);
    switch (a) {
        case "true":
            return !0;
        case "false":
            return !1;
        case "null":
            return null;
        case "undefined":
            return undefined;
        case "":
            return "";
        default:
            return isNaN(a) ? a : Number(a)
    }
}, Array.find = function (b, c, d) {
    for (var e = 0, f = b.length; e < f; e++) if (c.call(d, b[e])) return b[e]
}, Array.forEach || (Array.forEach = function (a, b, c) {
    for (var d = 0, e = a.length; d < e; d++) {
        var f = a[d];
        typeof f != "undefined" && b.call(c, f, d, a)
    }
}), head = document.getElementsByTagName("head")[0], queryString = window.location.search.substring(1).parseNameValuePairs(), embedSWF = function (a, b, c, d, e, f) {
    var g = {
        width: "1",
        height: "1",
        style: "visibility:visible;",
        border: "0"
    }, h = {
            quality: "high",
            bgcolor: "#000000",
            allowscriptaccess: "always",
            allowfullscreen: "true",
            wmode: "opaque"
        }, i = {}, j = document.createElement("div"),
        k, l = "",
        m = "",
        n = "",
        o = "";
    a.indexOf("?") > -1 && (qi = a.indexOf("?"), o = a.substr(qi + 1), a = a.substring(0, qi)), c == undefined && (c = document.body), c.appendChild(j);
    if (e) for (k in e) g[k] = e[k];
    if (f) for (k in f) h[k] = f[k];
    if (d) for (k in d) i[k] = d[k];
    for (k in h) l += '<param name="' + k + '" value="' + h[k] + '"/>';
    var p = [];
    for (k in i) p.push(k + "=" + i[k]);
    o != "" && p.push(o), m = p.join("&"), m != "" && (l += '<param name="flashvars" value="' + m + '"/>'), p = [];
    for (k in g) p.push(k + '="' + g[k] + '"');
    n = p.join(" ");
    var q = j.innerHTML = "<object" + (b ? ' id="' + b + '"' : "") + " " + n + " " + (' type="application/x-shockwave-flash" data="' + a + '">') + l + "</object>",
        r = j.getElementsByTagName("object")[0];
    return c.replaceChild(r, j), r
}, $.cors = function (a, b) {
    function g(c, e) {
        clearTimeout(f), d[c](b.context || b, [a, e])
    }
    b = b || {};
    var c = b.xhr = new $.cors.xhr,
        d = $.Deferred(),
        e = b.timeout || 3e4,
        f;
    return c.open(b.data ? "post" : "get", a, !0), c.onprogress = b.onprogess || function () {}, window.XDomainRequest ? c.timeout = e : f = setTimeout(function () {
        c.abort(), g("rejectWith", "timeout")
    }, e), c.onload = function (a) {
        a = a || event;
        var b = a.target && a.target.status;
        b && b !== 304 && (b < 200 || b > 300) ? g("rejectWith", "error") : g("resolveWith", c.responseText)
    }, c.onerror = c.ontimeout = function (a) {
        g("rejectWith", a.type)
    }, b.data ? (b.contentType && c.setRequestHeader && c.setRequestHeader("Content-Type", b.contentType), c.send(b.data)) : c.send(), d.promise()
}, $.cors.xhr = window.XDomainRequest ? XDomainRequest : "withCredentials" in new XMLHttpRequest ? XMLHttpRequest : function () {
    throw "NA"
}, formatter = {
    attributify: attributify
}, $.save = function (a) {
    return typeof a != "object" && (a = {
        url: a
    }), a.type = a.type || "post", a.error = a.error || function (b, c, d) {
        b.status == 401 ? comm.send("login.prompt", a.loginPromptSettings) : setTimeout(function () {
            Myspace.Error(a.errorSettings || {
                yes: {
                    onClick: function () {
                        return $.save(a)
                    }
                }
            })
        }, 550), $.isFunction(a.errorCallback) && a.errorCallback()
    }, $.ajax(a)
};
var partial = function (a, b) {
    return require("ejs").render(templates[a], b)
};
(function (a, b) {
    $(window).bind("mousemove keyup load", function () {
        b = 0, clearInterval(a), a = setInterval(function () {
            comm.send("page.idle", ++b)
        }, 6e4)
    })
})();
(function () {
    function a(a) {
        return a.value ? (a.value = unescape(a.value), a) : null
    }
    function b(a, b, c) {
        var e = a.toString(),
            f = [a.name + "=" + e];
        b && b.indexOf("localhost") < 0 && (b.charAt(0) !== "." && (b = "." + b), f.push("domain=" + b)), c && f.push("expires=" + c.toGMTString()), f.push("path=/"), document.cookie = f.join("; "), d()
    }
    function c(a, b) {
        b && b.charAt(0) != "." && (b = "." + b), b = b ? "; domain=" + b : "", document.cookie = a + "=" + b + "; expires=Sat, 01 Jan 2000 08:00:00 GMT; path=/", d()
    }
    function d() {
        Cookies = {};
        var a = e();
        for (var f in a) Cookies[f] = new Cookie(f, a[f]);
        Cookies.save = b, Cookies.remove = c, Cookies.refresh = d
    }
    function e() {
        return document.cookie.parseNameValuePairs(/\s?;\s?/)
    }
    window.Cookie = function (b, c) {
        var d = this,
            f;
        d.name = b, d.raw = c, d.value = unescape(c), d.value.indexOf("=") > -1 && (d.values = d.value.parseNameValuePairs("&", null, a)), this.refresh = function () {
            var a = e();
            Cookies[d.name] = new Cookie(d.name, a[d.name])
        }, Object.defineProperty(d, "parsedValues", {
            get: function () {
                if (d.values) {
                    f || (f = {});
                    for (var a in d.values) f[a] = d.values[a].parse()
                }
                return f
            }
        })
    }, Cookie.prototype = {
        toString: function () {
            var a = this.values;
            if (!a) return this.value;
            var b = [];
            for (var c in a) b[b.length] = c + "=" + escape(a[c]);
            return b.join("&")
        }
    }, d()
})();
var CookieHelper = function (a) {
    return function (b) {
        Cookies[a].refresh();
        if (typeof b == "string") {
            var c = Cookies[a].values[b];
            return typeof c == "string" ? c.parse() : c
        }
        typeof b == "object" && ($.extend(Cookies[a].values, b), Cookies.save(Cookies[a], "." + document.domain, (new Date).addDays(30)))
    }
};
comm = function (a) {
    function j(a, b, d) {
        if (!g(b)) return;
        var h = a.split(",");
        for (var i = 0; i < h.length; i++) a = h[i], c("listener added for: " + a), (e[a] || (e[a] = [])).push(b), d && (f[a] || (f[a] = [])).push(b)
    }
    function k(a, b, c) {
        if (!b) return;
        for (var d = 0; d < b.length; d++) try {
                b[d](c, a) === !0 && i.stopListening(a, b[d--])
        } catch (e) {
            i.onerror("comm handler error", e)
        }
    }
    var b = function () {}, c = a && a.log ? function (b) {
            i.debug && (g(i.debug) ? i.debug(b) : a.log(b))
        } : b,
        d = {}, e = {}, f = {}, g = function (a) {
            return Object.prototype.toString.call(a) === "[object Function]"
        }, h = function (a, b) {
            if (b.indexOf) return b.indexOf(a);
            for (var c = 0, d = b.length; c < d; c++) if (b[c] === a) return c;
            return -1
        }, i = {
            onerror: b,
            own: function (a, b, f) {
                if (d[a]) throw new Error(a + " already registered");
                if (!b) throw new Error("invalid switchboard");
                d[a] = {
                    switchboard: b,
                    before: f
                };
                var g = function (a, b) {
                    k(a, e[a], b)
                };
                return {
                    broadcast: function (b, d) {
                        if (!g) throw new Error("This controller has been abandoned");
                        b = a + "." + b, c("broadcasting: " + b), g(b, d)
                    },
                    abandon: function () {
                        if (!g) throw new Error("This controller has already been abandoned");
                        c("abandoned control of: " + a), delete d[a], g = null
                    }
                }
            },
            listen: function (a, b, c) {
                if (typeof a == "object") for (var d in a) {
                        var e = a[d];
                        if (typeof e != "object") continue;
                        for (var f in e) {
                            var c = f.charAt(0) == "+",
                                g = e[f];
                            j(d + "." + (c ? f.substr(1) : f), g, c)
                        }
                } else j(a, b, c)
            },
            stopListening: function (a, b) {
                var d = e[a];
                if (!d) return;
                var g = h(b, d);
                if (g == -1) return;
                d.splice(g, 1), d = f[a], d && (g = h(b, d), g > -1 && d.splice(g, 1)), c("listener removed for: " + a)
            },
            send: function (a, b) {
                c("sending: " + a);
                var f = a.match(/([^.]+)(?:\.(.+))?/).slice(1);
                if (f.length != 2) throw new Error("invalid command");
                var g = d[f[0]];
                if (g) {
                    a = f[1];
                    if (g.switchboard[a]) {
                        if (g.before && g.before(a, b)) return;
                        g.switchboard[a](b)
                    } else g.switchboard["*"] && g.switchboard["*"](a, b)
                } else k(a, e[a], b)
            },
            _clearListeners: function () {
                e = {};
                for (var a in f) e[a] = f[a].slice(0)
            }
        };
    return i
}(window.console);
window.scomm || function (a) {
    function l(a) {
        return a && Object.prototype.toString.call(a) == "[object Function]"
    }
    function m(a, b, c) {
        a.addEventListener ? a.addEventListener(b, c, !1) : a.attachEvent("on" + b, c)
    }
    function n(a) {
        if (a.length != 18 && !b.test(a)) return;
        j = 1, scomm = {
            hash: h,
            debug: scomm.debug,
            add: scomm.add,
            remove: scomm.remove,
            send: function (a, b, d, e, g) {
                if (d == h) throw new Error("You cannot talk to yourself");
                d = d || "scomm*";
                var j = {
                    cmd: a,
                    data: b,
                    sender: h,
                    ts: +(new Date),
                    to: d
                };
                d != "scomm*" && (j.token = setTimeout(function () {
                    i("failed to send", j), e && e(a, b, d)
                }, 2e3), g && (f[j.token] = g)), j = d + JSON.stringify(j), i("postMessage to iframe", j), k.contentWindow.postMessage(j, c)
            },
            ready: function (a) {
                a()
            }
        }, i("iframe ready");
        var d;
        while (d = g.shift()) d();
        g = undefined
    }
    function o(a) {
        var d;
        a = a.replace(b, function (a) {
            return d = a, ""
        });
        if (!d || d != h && d != "scomm*" && d != "scomm_") return;
        var g = JSON.parse(a);
        if (d == "scomm_") {
            g.cmd == "clear" ? p(g.cmd, null, null) : e[g.callback].apply(this, g.args);
            return
        }
        if (g.sender == h) {
            i("ignoring ourself");
            return
        }
        i("processing message", a);
        if (g.token) {
            if (!g.cmd) {
                clearTimeout(g.token | 0), i("message confirmed");
                var l = f[g.token];
                l && delete f[g.token] && l();
                return
            }
            var j = g.sender + JSON.stringify({
                sender: h,
                ts: +(new Date),
                to: g.sender,
                token: g.token
            });
            i("posting acknowledgement to iframe", j), k.contentWindow.postMessage(j, c)
        }
        p(g.cmd, g.data, g.sender)
    }
    function p(a, b, c) {
        i("triggering handlers");
        for (var e = 0, f = d.length; e < f; e++) d[e](a, b, c) === !0 && scomm.remove(d[e])
    }
    var b = /^scomm\d{13}|scomm\*|scomm_/,
        c = config.urls.cdn ? "https://x.myspacecdn.com" : a.protocol + "//" + a.host,
        d = [],
        e = {}, f = {}, g = [],
        h = sessionStorage.scomm = "scomm" + +(new Date),
        i = window.console && console.log ? function (a, b) {
            scomm.debug && (l(scomm.debug) ? scomm.debug(a, b) : console.log(a, b))
        } : function () {}, j, k = document.createElement("iframe");
    k.id = "scomm", k.src = config.urls.scomm + "#" + h, k.width = 0, k.height = 0, k.style.border = 0, scomm = {
        hash: h,
        debug: window.location.search.indexOf("scomm=") > -1,
        add: function (a) {
            if (!l(a)) return;
            d.push(a), i("listener added")
        },
        remove: function (a) {
            if (!l(a)) return;
            for (var b = 0, c = d.length; b < c; b++) d[b] === a && d.splice(b, 1);
            i("listener removed")
        },
        ready: function (a) {
            if (!l(a)) return;
            g.push(a)
        },
        send: function (a, b, c, d, e) {
            scomm.ready(function () {
                scomm.send(a, b, c, d, e)
            })
        }
    }, i("adding iframe"), m(window, "message", function (a) {
        i("message received from iframe", a.data);
        if (!j) {
            n(a.data);
            return
        }
        if (a.origin != c) return;
        o(a.data)
    }), document.body.appendChild(k)
}(window.location);

function require(a) {
    if ("fs" == a) return {};
    var b = require.resolve(a),
        c = require.modules[b];
    if (!c) throw new Error('failed to require "' + a + '"');
    return c.exports || (c.exports = {}, c.call(c.exports, c, c.exports, require.relative(b))), c.exports
}
require.modules = {}, require.resolve = function (a) {
    var b = a,
        c = a + ".js",
        d = a + "/index.js";
    return require.modules[c] && c || require.modules[d] && d || b
}, require.register = function (a, b) {
    require.modules[a] = b
}, require.relative = function (a) {
    return function (b) {
        if ("." != b.substr(0, 1)) return require(b);
        var c = a.split("/"),
            d = b.split("/");
        c.pop();
        for (var e = 0; e < d.length; e++) {
            var f = d[e];
            ".." == f ? c.pop() : "." != f && c.push(f)
        }
        return require(c.join("/"))
    }
}, require.register("ejs.js", function (a, b, c) {
    function h(a) {
        return a.substr(1).split("|").reduce(function (a, b) {
            var c = b.split(":"),
                d = c.shift(),
                e = c.shift() || "";
            return e && (e = ", " + e), "filters." + d + "(" + a + e + ")"
        })
    }
    function i(a, b, c, d) {
        var e = b.split("\n"),
            f = Math.max(d - 3, 0),
            g = Math.min(e.length, d + 3),
            h = e.slice(f, g).map(function (a, b) {
                var c = b + f + 1;
                return (c == d ? " >> " : "    ") + c + "| " + a
            }).join("\n");
        throw a.path = c, a.message = (c || "ejs") + ":" + d + "\n" + h + "\n\n" + a.message, a
    }
    var d = c("./utils"),
        e = c("fs");
    b.version = "0.6.1";
    var f = b.filters = c("./filters"),
        g = {};
    b.clearCache = function () {
        g = {}
    };
    var j = b.parse = function (a, c) {
        var c = c || {}, d = c.open || b.open || "<%",
            e = c.close || b.close || "%>",
            f = ["var buf = [];", "\nwith (locals) {", "\n  buf.push('"],
            g = 1;
        for (var i = 0, j = a.length; i < j; ++i) if (a.slice(i, d.length + i) == d) {
                i += d.length;
                var k, l, m = "__stack.lineno=" + g;
                switch (a.substr(i, 1)) {
                    case "=":
                        k = "', escape((" + m + ", ", l = ")), '", ++i;
                        break;
                    case "-":
                        k = "', (" + m + ", ", l = "), '", ++i;
                        break;
                    default:
                        k = "');" + m + ";", l = "; buf.push('"
                }
                var n = a.indexOf(e, i),
                    o = a.substring(i, n),
                    p = i,
                    q = 0;
                while (~(q = o.indexOf("\n", q))) q++, g++;
                o.substr(0, 1) == ":" && (o = h(o)), f.push(k, o, l), i += n - p + e.length - 1
            } else a.substr(i, 1) == "\\" ? f.push("\\\\") : a.substr(i, 1) == "'" ? f.push("\\'") : a.substr(i, 1) == "\r" ? f.push(" ") : a.substr(i, 1) == "\n" ? (f.push("\\n"), g++) : f.push(a.substr(i, 1));
        return f.push("');\n}\nreturn buf.join('');"), f.join("")
    }, k = b.compile = function (a, c) {
            c = c || {};
            var e = JSON.stringify(a),
                g = c.filename ? JSON.stringify(c.filename) : "undefined";
            a = ["var __stack = { lineno: 1, input: " + e + ", filename: " + g + " };", i.toString(), "try {", b.parse(a, c), "} catch (err) {", "  rethrow(err, __stack.input, __stack.filename, __stack.lineno);", "}"].join("\n"), c.debug && console.log(a);
            var h = new Function("locals, filters, escape", a);
            return function (a) {
                return h.call(this, a, f, d.escape)
            }
        };
    b.render = function (a, b) {
        var c, b = b || {};
        if (b.cache) {
            if (!b.filename) throw new Error('"cache" option requires "filename".');
            c = g[b.filename] || (g[b.filename] = k(a, b))
        } else c = k(a, b);
        return b.__proto__ = b.locals, c.call(b.scope, b)
    }, b.renderFile = function (a, c, d) {
        var f = a + ":string";
        "function" == typeof c && (d = c, c = {}), c.filename = a;
        try {
            var g = c.cache ? b.cache[f] || (b.cache[f] = e.readFileSync(a, "utf8")) : e.readFileSync(a, "utf8");
            d(null, b.render(g, c))
        } catch (h) {
            d(h)
        }
    }, b.__express = b.renderFile, c.extensions ? c.extensions[".ejs"] = function (a, b) {
        source = c("fs").readFileSync(b, "utf-8"), a._compile(k(source, {}), b)
    } : c.registerExtension && c.registerExtension(".ejs", function (a) {
        return k(a, {})
    })
}), require.register("filters.js", function (a, b, c) {
    b.first = function (a) {
        return a[0]
    }, b.last = function (a) {
        return a[a.length - 1]
    }, b.capitalize = function (a) {
        return a = String(a), a[0].toUpperCase() + a.substr(1, a.length)
    }, b.downcase = function (a) {
        return String(a).toLowerCase()
    }, b.upcase = function (a) {
        return String(a).toUpperCase()
    }, b.sort = function (a) {
        return Object.create(a).sort()
    }, b.sort_by = function (a, b) {
        return Object.create(a).sort(function (a, c) {
            return a = a[b], c = c[b], a > c ? 1 : a < c ? -1 : 0
        })
    }, b.size = b.length = function (a) {
        return a.length
    }, b.plus = function (a, b) {
        return Number(a) + Number(b)
    }, b.minus = function (a, b) {
        return Number(a) - Number(b)
    }, b.times = function (a, b) {
        return Number(a) * Number(b)
    }, b.divided_by = function (a, b) {
        return Number(a) / Number(b)
    }, b.join = function (a, b) {
        return a.join(b || ", ")
    }, b.truncate = function (a, b) {
        return a = String(a), a.substr(0, b)
    }, b.truncate_words = function (a, b) {
        var a = String(a),
            c = a.split(/ +/);
        return c.slice(0, b).join(" ")
    }, b.replace = function (a, b, c) {
        return String(a).replace(b, c || "")
    }, b.prepend = function (a, b) {
        return Array.isArray(a) ? [b].concat(a) : b + a
    }, b.append = function (a, b) {
        return Array.isArray(a) ? a.concat(b) : a + b
    }, b.map = function (a, b) {
        return a.map(function (a) {
            return a[b]
        })
    }, b.reverse = function (a) {
        return Array.isArray(a) ? a.reverse() : String(a).split("").reverse().join("")
    }, b.get = function (a, b) {
        return a[b]
    }, b.json = function (a) {
        return JSON.stringify(a)
    };
    var d = /\[([^\s|]+)\|(lnk.ms\/\w+)\]/g;
    b.linkify = function (a) {
        return a ? a.replace(d, function (a, b, c) {
            return '<a href="http://' + c + '" target="_blank">' + b + "</a>"
        }) : a
    }
}), require.register("utils.js", function (a, b, c) {
    b.escape = function (a) {
        return String(a).replace(/&(?!\w+;)/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;")
    }
});
(function () {
    function a() {
        return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (a) {
            var b = Math.random() * 16 | 0,
                c = a == "x" ? b : b & 3 | 8;
            return c.toString(16)
        })
    }
    Myspace = Myspace || {}, Myspace.Utils = Myspace.Utils || {}, Myspace.Utils.guid = a
})();
(function () {
    Myspace = Myspace || {};
    var a = {};
    Object.defineProperty(a, "isLoggedIn", {
        get: function () {
            return context.profileId > 0
        }
    }), Myspace.User = a
})();
(function (a) {
    function d(b) {
        var c = b || window.event,
            d = [].slice.call(arguments, 1),
            e = 0,
            f = !0,
            g = 0,
            h = 0;
        return b = a.event.fix(c), b.type = "mousewheel", c.wheelDelta && (e = c.wheelDelta / 120), c.detail && (e = -c.detail / 3), h = e, c.axis !== undefined && c.axis === c.HORIZONTAL_AXIS && (h = 0, g = -1 * e), c.wheelDeltaY !== undefined && (h = c.wheelDeltaY / 120), c.wheelDeltaX !== undefined && (g = -1 * c.wheelDeltaX / 120), d.unshift(b, e, g, h), (a.event.dispatch || a.event.handle).apply(this, d)
    }
    var b = ["DOMMouseScroll", "mousewheel"];
    if (a.event.fixHooks) for (var c = b.length; c;) a.event.fixHooks[b[--c]] = a.event.mouseHooks;
    a.event.special.mousewheel = {
        setup: function () {
            if (this.addEventListener) for (var a = b.length; a;) this.addEventListener(b[--a], d, !1);
            else this.onmousewheel = d
        },
        teardown: function () {
            if (this.removeEventListener) for (var a = b.length; a;) this.removeEventListener(b[--a], d, !1);
            else this.onmousewheel = null
        }
    }, a.fn.extend({
        mousewheel: function (a) {
            return a ? this.bind("mousewheel", a) : this.trigger("mousewheel")
        },
        unmousewheel: function (a) {
            return this.unbind("mousewheel", a)
        }
    }), a("body").delegate("div.horizontalContent:not(.nowheeljack) > div, div.horizontal:not(.nowheeljack) > ul, #drawer div.horizontal", "mousewheel", function (a, b, c, d) {
        Math.abs(d) >= Math.abs(c) && (this.scrollLeft -= d * 30, a.preventDefault())
    })
})(jQuery);
var Myspace = Myspace || {};
Myspace.DragDropManager = function (a) {
    function i(e) {
        j(e), k(), a("body").delegate('[draggable="true"]:not(#mixes [draggable="true"]):not(#friendsGrid [draggable="true"]):not(.manage [draggable="true"])', "dragstart", function (e) {
            var f;
            c = a(e.target).closest('[draggable="true"]'), d.dragStart(e, c);
            if (!b || b.length == 0) b = a('<div id="ghost"></div>'), a("#container").append(b);
            b.html(d.dragContent()), a(this).bind("dragend", function (a) {
                m(a)
            }), f = e.originalEvent.dataTransfer, f.setData("Text", d.dragText()), f.effectAllowed = "copy", f.dropEffect = "copy", f.setDragImage(b[0], 20, 20), g = !0
        })
    }
    function j(a) {
        d = {
            droppables: a.droppables || [],
            ignoreSelectors: a.ignoreSelectors,
            dragText: a.dragText || h,
            dragContent: a.dragContent || h,
            dragStart: a.dragStart || h,
            dragEnd: a.dragEnd || h,
            dragEnter: a.dragEnter || h,
            dragLeave: a.dragLeave || h,
            drop: a.drop || h,
            dragOverLogic: a.dragOverLogic
        }
    }
    function k() {
        for (var b = 0, c = d.droppables.length; b < c; b++) d.droppables[b].not('[data-droptarget="true"]').each(function () {
                l(a(this))
            })
    }
    function l(a) {
        a.bind("dragenter", function (a) {
            c && (e = !0, n(a))
        }), a.bind("dragover", function (a) {
            c && (e = !0, o(a))
        }), a.bind("dragleave", function (a) {
            c && (e = !1, p(a))
        }), a.bind("drop", function (a) {
            c && (e = !1, q(a))
        }), a.attr("data-droptarget", "true")
    }
    function m(b) {
        return b.preventDefault(), c = null, u.reset(b, function (a, b) {
            d.dragEnd(a, b)
        }), a(b.target).unbind("dragend"), g = !1, !1
    }
    function n(a) {
        return a.preventDefault(), u.enter(a, function (a, b, c) {
            f = d.dragOverLogic(a, b), d.dragEnter(a, b, c)
        }), !1
    }
    function o(a) {
        a.preventDefault();
        var b = a.originalEvent.dataTransfer;
        return b.dropEffect = f ? "copy" : "none", !1
    }
    function p(a) {
        return a.preventDefault(), u.leave(a, function (a, b) {
            d.dragLeave(a, b)
        }), !1
    }
    function q(a) {
        return a.preventDefault(), u.reset(a, function (a, b) {
            d.drop(a, b)
        }), !1
    }
    function r(a) {
        d.droppables.push(a), k()
    }
    function s() {
        return e
    }
    function t() {
        return g
    }
    var b, c, d, e = !1,
        f = !0,
        g = !1,
        h = function () {
            return ""
        }, u = {
            count: 0,
            $droppable: null,
            enter: function (b, d) {
                var e = a(b.delegateTarget),
                    f = "up";
                if (c[0] == e[0]) return d(b, e);
                this.count++;
                if (!this.$droppable || this.$droppable[0] != e[0]) c.index() < e.index() && (f = "down"), this.$droppable = e, d(b, e, f)
            },
            leave: function (b, d) {
                var e = a(b.delegateTarget);
                if (c[0] == e[0]) return d(b, e);
                this.count--;
                if (this.$droppable && this.$droppable[0] != e[0] || this.count === 0) d(b, e), this.count === 0 && (this.$droppable = null)
            },
            reset: function (a, b) {
                this.$droppable ? b(a, this.$droppable) : b(a), this.$droppable = null, this.count = 0
            }
        };
    return {
        init: i,
        addDroppables: r,
        isOverDroppable: s,
        isBeingDragged: t
    }
}(jQuery);
var Myspace = Myspace || {};
Myspace.DragDrop = function (a) {
    function t() {
        return b.title + " by " + b.author
    }
    function u() {
        return "<strong>" + b.title + "</strong><span>" + b.author + "</span>"
    }
    function v() {
        p && clearInterval(p)
    }
    function w(b, c) {
        a("#mixData").length && (c = a("#mixData")), m ? (v(), p = setInterval(function () {
            var a = d - e,
                b = c[0].scrollTop;
            if (a >= 0 && a < 100 && b !== 0) c[0].scrollTop = b - 10;
            else {
                var g = e + f - d;
                g < 100 && (c[0].scrollTop = b + 10)
            }
        }, 50)) : v()
    }
    function x(a) {
        return a.height() < a.prop("scrollHeight")
    }
    function y(k, l) {
        c = l, b = objectify(l.find(".playBtn")), H(), r = h.attr("data-panel"), j = !1, N() ? (g.removeClass("queueOpen"), j = !0, a("#mixData").length ? q = a("#mixData") : q = c.parent().parent(), m = x(q), m && (e = q.position().top, f = q.height(), q.bind("dragover", function (a) {
            d = a.originalEvent.pageY
        }))) : (n = setTimeout(function () {
            g.addClass("dropZone"), comm.send("drawer.open", "mixes")
        }, 200), b.type === "mix" ? i.find("li.mix,li.connectedMix,li.newMix,li.radio").addClass("hide") : b.radioStationEntityKey || i.find("li.radio").addClass("hide")), setTimeout(function () {
            comm.send("hcard.hide")
        }, 100)
    }
    function A(a, b) {
        clearTimeout(n), clearTimeout(o), comm.send("drawer.panel", r), h.hasClass("pinned") || comm.send("drawer." + (z ? "closeOnLeave" : "close")), j && b && b.removeClass("up down"), i.find("li").removeClass("hide"), l || (g.removeClass("dropZone"), b && b.removeClass("hovered")), l = !1, q && (q.unbind("dragover"), v())
    }
    function B(a, b, c) {
        k = O(b), j ? M(b) ? (b.addClass(c), g.removeClass("queueOpen dropZone")) : (g.addClass("dropZone"), comm.send("drawer.open", "mixes"), b.addClass("hovered")) : O(b) && b.addClass("hovered")
    }
    function C(a, b) {
        j && (M(b) && (clearTimeout(o), o = setTimeout(function () {
            Myspace.DragDropManager.isOverDroppable() || (g.addClass("dropZone"), comm.send("drawer.open", "mixes"))
        }, 500)), b.removeClass("up down")), b.removeClass("hovered")
    }
    function D(a, d) {
        var e = d.parent(),
            f = c.parent();
        return e.hasClass("table") && e.hasClass("own") && f[0] != e[0] ? !1 : b.type === "mix" && d.attr("id") === "createMix" ? !1 : (e.hasClass("table") && e.hasClass("own") && w(a, e.parent()), !0)
    }
    function E(a, d) {
        var e = {}, f = c.parent();
        if (j && !k) l = !0, d.hasClass("up") ? (d.removeClass("up"), d.before(c)) : d.hasClass("down") && (d.removeClass("down"), d.after(c)), f.scroll(), e.mediaType = b.mediaType, e.sequenceId = b.sequenceId, e.beforeSequenceId = c.next().find(".playBtn").data("sequence-id") || null, e.objectVersion = f.data("objectversion"), e.playlistId = f.data("playlistid"), comm.send("mix.moveItem", e), g.removeClass("dropZone"), clearTimeout(o);
        else if (k) {
            l = !0;
            switch (d.data("dest")) {
                case "playNext":
                    J("insert");
                    break;
                case "playLast":
                    J("append");
                    break;
                case "radio":
                    K();
                    break;
                case "createMix":
                    Myspace.User.isLoggedIn ? I(d, "create") : comm.send("login.prompt");
                    break;
                case "message":
                    Myspace.User.isLoggedIn ? F() : comm.send("login.prompt");
                    break;
                case "sendinstantmessage":
                    G(d.data("entityKey"));
                    break;
                default:
                    I(d, "addItem")
            }
            d.removeClass("hovered").addClass("active"), setTimeout(function () {
                d.removeClass("active"), g.removeClass("dropZone")
            }, 500)
        }
    }
    function F() {
        r = "messaging", comm.send("messaging.popout", b)
    }
    function G(a) {
        var c = b.entityKey;
        Myspace.MessagingManager.getMediaHtml(c).done(function (b) {
            var d = {
                toEntity: a,
                mediaEntityKey: c,
                mediaHtml: b
            };
            comm.send("instantmessage.send", d)
        })
    }
    function H() {
        var a, c, d, e = b.type ? b.type : b.mediaType;
        e === "mixtape" ? e = "mix" : b.type === "song" && (e = "audio"), b.mediaId ? d = b.mediaId : d = e === "audio" ? b.songId : b.videoId;
        switch (e) {
            case "video":
                a = b.title, c = b.artistName;
                break;
            case "mix":
                a = b.title, c = b.owner;
                break;
            case "radio":
                a = b.name, c = "";
                break;
            case "album":
            case "audio":
                a = b.title, c = b.artistName;
                break;
            default:
                a = "", c = ""
        }
        b.title = a, b.author = c, b.mediaId = d, b.type = e
    }
    function I(c, d) {
        var e = {}, f;
        e.onSuccess = function (d) {
            var e, f = c.find(".playBtn");
            f.length ? e = f.data("title") : typeof d == "string" && (e = d), typeof d == "object" && a(".table.own").length && comm.send("table.newItem", d), comm.send("toasts.new", {
                html: "<li>" + b.title + "<br />was added to<br />" + e + "</li>",
                timeout: 3e3
            })
        }, b.type === "audio" ? (e.mediaId = b.songId, e.mediaType = "audio", b.mediaReleaseId && (e.releaseId = b.mediaReleaseId)) : b.type === "album" ? (e.mediaId = b.albumId, e.mediaType = "album") : b.type === "video" && (e.mediaId = b.mediaId, e.mediaType = "video", b.mediaReleaseId && (e.releaseId = b.mediaReleaseId)), d == "addItem" ? (f = c.find(".playBtn"), e.playlistId = f.data("playlist-id"), e.objectVersion = f.data("object-version"), comm.send("mix." + d, e)) : (e.title = b.title, comm.send("mix." + d, e))
    }
    function J(a) {
        var c = b.type;
        c === "mix" ? comm.send("queue." + a + ".mixtape", b) : c === "album" ? comm.send("queue." + a + ".album", b) : c === "audio" ? comm.send("queue." + a + ".song", b) : c === "video" && comm.send("queue." + a + ".video", b), r = "queue"
    }
    function K() {
        comm.send("radio.start", {
            radioStationEntityKey: b.radioStationEntityKey,
            name: b.title,
            imageUrl: b.imageUrl
        })
    }
    function L() {
        comm.send("connect", {
            entityKey: b.entityKey,
            onSuccess: function (a) {
                b.type === "mix" && (comm.send("connect.status", {
                    entityKey: b.entityKey
                }), comm.send("mix.addConnected", {
                    playlistId: b.playlistId,
                    profileId: b.profileId
                }))
            }
        })
    }
    function M(a) {
        return a.parent().hasClass("table")
    }
    function N() {
        return (b.type === "audio" || b.type === "video") && c.parent().hasClass("own")
    }
    function O(a) {
        return a.parent().parent().parent().attr("id") === "mixes" || a.hasClass("chat")
    }
    function P() {
        Myspace.DragDropManager.init(s)
    }
    function Q(a) {
        Myspace.DragDropManager.addDroppables(a)
    }
    var b, c, d = 0,
        e = 0,
        f = 0,
        g = a("body"),
        h = a("#drawer"),
        i = a("#mixes"),
        j = !1,
        k = !1,
        l = !1,
        m = !1,
        n, o, p, q, r = h.attr("data-panel"),
        s = {
            droppables: [a("#mixes").find("li.mix,li.util")],
            dragText: t,
            dragContent: u,
            dragStart: y,
            dragEnd: A,
            dragEnter: B,
            dragLeave: C,
            drop: E,
            dragOverLogic: D
        }, z;
    return g.on("dragenter", function (c) {
        z = !! a(c.target).closest("#footer").length
    }), P(), {
        addDroppables: Q
    }
}(jQuery);
(function (a) {
    a.secureAjax = a.ajax;
    if (a.secureAjax) return;
    if (window.location.protocol == "https:") a.secureAjax = a.ajax;
    else {
        var b = window.context.env === "development" ? "http://" : "https://",
            c = b + window.location.host,
            d = "/common/html/secureAjax.html",
            e = document.createElement("iframe"),
            f = {};
        e.id = "secureAjax", e.src = c + d, e.width = 0, e.height = 0, e.style.border = 0, document.body.appendChild(e);

        function g(a) {
            var b = a.ajaxId = +(new Date),
                g = a.context || a;
            f[b] = function (b) {
                var c = b.xhr,
                    d = c.status;
                typeof b.error != "undefined" && a.error ? a.error.call(g, c, b.textStatus, b.error) : typeof b.data != "undefined" && a.success && a.success.call(g, b.data, b.textStatus, c), a.complete && a.complete.call(g, c, b.textStatus)
            }, a.headers = {
                Hash: context.hashMashter
            }, e.contentWindow.postMessage(JSON.stringify(a), c + d)
        }
        function h(a) {
            if (a.origin === c) {
                var b = JSON.parse(a.data),
                    d = f[b.ajaxId];
                d && d(b)
            }
        }
        window.addEventListener ? window.addEventListener("message", h, !1) : window.attachEvent("onmessage", h), a.secureAjax = g
    }
})(jQuery);
var Myspace = Myspace || {};
(function (a) {
    function f(a) {
        var c = b,
            d = a.$root[0],
            e = 0,
            f = c.length,
            g;
        b = [];
        for (; e < f; e++) g = c[e], g.$root[0] != d && b.push(g)
    }
    function g() {
        var a, c = b.length,
            d;
        if (c) {
            a = b[c - 1], d = a.$root;
            if (d.hasClass("lightbox") && d.hasClass("donotescape")) return;
            a.hide(), a.options.closeAll && h()
        }
        e = !1
    }
    function h(a) {
        var c = a && a.jquery ? a[0] : a,
            d = 0,
            e = b.length,
            f;
        for (; d < e; d++) f = b[d], f.$root[0] != c && (f.hide(), e--, d--)
    }
    var b = [],
        c = a("#dialogCover"),
        d = a("#lightboxCover"),
        e;
    comm.listen("page.esc", function () {
        e ? e = !1 : g()
    }, !0), comm.listen("upload.browseOpen", function () {
        e = !0
    }, !0), comm.listen("upload.browseClose", function () {
        e = !1
    }, !0), d.find(".close").click(g), d.find(".info").click(g), Myspace.Dialog = function (e, g) {
        function o(a) {
            if (m) return;
            g.closeAll && h(j), i("showing", j), k || l.click(p), g.onShow(), l.removeClass("hide"), g.centerDialog && r(), j.addClass("open").removeClass("close"), a || j.find("input[type=text], input[type=email], input[type=password], textarea").first().focus(), m = !0, b.push(t)
        }
        function p() {
            if (m == 0) return;
            g.onHide(), k ? !g.closeAll && b.length > 1 || l.addClass("hide") : l.addClass("hide"), j.addClass("close"), k ? j.removeClass("open").removeClass("close") : setTimeout(function () {
                j.removeClass("open").removeClass("close")
            }, 500), m = !1, k || l.off("click", p), f(t), i("hiding", j)
        }
        function q() {
            m ? p() : o()
        }
        function r() {
            var b = j.outerWidth() / 2,
                c = j.outerHeight() / 2,
                d;
            d || (d = a("#global").outerHeight() + a("#links").outerHeight() || 60), c += d / 2, j.css({
                "margin-left": "-" + b + "px",
                "margin-top": "-" + c + "px"
            })
        }
        function s() {
            return !m
        }
        var j = a(e),
            k = j.hasClass("lightbox"),
            l = k ? d : c,
            m = j.hasClass("open"),
            n = {
                centerDialog: !0,
                closeAll: !0,
                onShow: a.noop,
                onHide: a.noop
            };
        g = a.extend({}, n, g), comm.listen("spaceway.page.loading", h, !0), j.find(".close").click(p);
        var t = {
            show: o,
            hide: p,
            toggle: q,
            center: r,
            isClosed: s,
            $root: j,
            options: g
        };
        return m && b.push(t), t
    };
    var i = comm.own("dialog", {
        closeAll: h,
        isOpen: function (a) {
            typeof a == "function" && a(b.length)
        }
    }).broadcast,
        j = {
            html: "",
            close: !0,
            buttons: [{
                    text: "OK",
                    classes: "primary",
                    click: function () {},
                    setFocus: !0
                }
            ]
        };
    Myspace.genericDialog = function (b) {
        var c = b.id || "genericDialog",
            d = a('<article id="' + c + '" class="dialog"></article>').appendTo("body"),
            e;
        b = a.extend({}, j, b), d.addClass(b.classes), b.close && a('<i class="close x_14">Close</i>').appendTo(d), b.html && a(b.html).appendTo(d);
        if (b.buttons && b.buttons.length) {
            var f = a("<footer>").appendTo(d),
                g = 0,
                h = b.buttons.length,
                i;
            for (; g < h; g++) {
                i = b.buttons[g];
                var k = a("<button>").appendTo(f).addClass(i.classes).text(i.text);
                k.click(function (b) {
                    return function (c) {
                        if (a.isFunction(b.click) && b.click(c) === !1) return;
                        return l.hide(), !1
                    }
                }(i)), i.setFocus && (e = k)
            }
        }
        var l = Myspace.Dialog(d, b);
        return comm.listen("dialog.hiding", function (a) {
            a.attr("id") == c && setTimeout(function () {
                l.$root.remove()
            }, 500)
        }), l.show(), e && e.focus(), delete l.show, l
    }, Myspace.noticeBoard = function (a) {
        a.id = "noticeBoard";
        var b = Myspace.genericDialog(a);
        return b
    }, Myspace.successDialog = function (a, b) {
        b && (b = "<h4>" + b + "</h4>");
        var c = Myspace.genericDialog({
            html: "<section>" + (b || "") + "<span>&nbsp;</span><span>" + a + "</span></section>",
            close: !1,
            buttons: null,
            id: "successDialog"
        });
        setTimeout(function () {
            c.hide()
        }, 4e3)
    }
})(jQuery),
function (a) {
    function i(h) {
        b = a('<article id="confirmDialog" class="dialog"></dialog><p></p><div class="actions"><button class="no"></button><button class="yes primary"></button></div></article>'), c = b.children("p"), d = b.children(".actions"), e = d.children(".no"), f = d.children(".yes"), a("body").append(b), g = new Myspace.Dialog(b, h)
    }
    var b, c, d, e, f, g = null,
        h = {
            text: "Are you sure?",
            no: {
                text: "No thanks.",
                onClick: function () {}
            },
            yes: {
                text: "Yes please.",
                onClick: function () {}
            }
        };
    Myspace.Error = function (b) {
        var c = {
            text: "Oops, something went wrong and we were unable to complete your request.  Do you want to try again?",
            no: {
                text: "No"
            },
            yes: {
                text: "Retry"
            }
        }, d = a.extend(!0, {}, c, b);
        Myspace.Confirm(d)
    }, Myspace.Confirm = function (b) {
        function d() {
            k(), g.show(), f.focus()
        }
        function j() {
            g.hide()
        }
        function k() {
            c.html(b.text), e.toggleClass("hide", b.no === !1).text(b.no.text || "").unbind("click").click(function () {
                return b.no.onClick(), j(), !1
            }), f.toggleClass("hide", b.yes === !1).text(b.yes.text || "").unbind("click").click(function () {
                return b.yes.onClick(), j(), !1
            })
        }
        g || i(b), b = a.extend(!0, {}, h, b), b.beforeShow && b.beforeShow(g), d()
    }
}(jQuery);
(function () {
    var a = $("#global > nav");
    a.find(".signUp").click(function (a) {
        a.preventDefault(), comm.send("signup.show", {
            reset: !0,
            context: {
                action: "signUpFooter"
            }
        })
    }), a.find(".signIn").click(function (a) {
        a.preventDefault(), comm.send("login.show", {
            context: {
                action: "signInFooter"
            }
        })
    }), comm.listen({
        spaceway: {
            "+page.complete": function () {
                a.find("li[data-name]").removeClass("selected"), context.selectedGlobalNav && a.find("li[data-name=" + context.selectedGlobalNav + "]").addClass("selected")
            },
            "+page.loading": function (b) {
                a.find("li[data-name]").removeClass("selected"), a.find('li > a[href="' + b + '"]').parent().addClass("selected")
            }
        }
    }), comm.listen("username.changed", function (b) {
        a.find("li[data-name=profile] > a").attr("href", "/" + b)
    }, !0)
})();
Myspace.Slider = function (a, b) {
    function k() {
        var b = d[g](!0),
            c = a[g](),
            e = a.offset()[h] + b / 2,
            f = e + c - b;
        return {
            min: e,
            max: f,
            distance: f - e,
            outer: c
        }
    }
    b = {
        axis: b.axis || "y",
        units: b.units || "px",
        start: b.start || $.noop,
        drag: b.drag || $.noop,
        stop: b.stop || $.noop,
        jump: b.jump || $.noop
    };
    var c = $("body"),
        d = a.find(".handle").length > 0 ? a.find(".handle") : $('<div class="handle">').appendTo(a),
        e = b.axis == "x",
        f = e ? "pageX" : "pageY",
        g = e ? "outerWidth" : "outerHeight",
        h = e ? "left" : "top",
        i = d[0] && d[0].style,
        j;
    a.click(function (c) {
        if (a.attr("disabled") != undefined) return;
        var e = c[f],
            g = k();
        e = (e < g.min ? g.min : e > g.max ? g.max : e) - g.min, i[h] = b.units == "px" ? e + "px" : e / g.distance * 100 + "%", b.jump.call(d[0], e, g.distance)
    }), d.mousedown(function (e) {
        if (a.attr("disabled") != undefined) return;
        j = 1, a.addClass("dragging");
        var g = k(),
            l = d.position()[h];
        return c.mousemove(function (a) {
            var c = a[f];
            c = (c < g.min ? g.min : c > g.max ? g.max : c) - g.min, c != l && (i[h] = b.units == "px" ? (l = c) + "px" : (l = c) / g.outer * 100 + "%", b.drag.call(d[0], c, g.distance))
        }).bind("mouseup", function (e) {
            j = 0, c.unbind("mousemove mouseup"), a.removeClass("dragging"), b.stop.call(d[0], l, g.distance)
        }), b.start.call(d[0], l, g.distance), !1
    }).click(function (a) {
        return !1
    }), this.percent = function (a) {
        if (j) return this;
        a = a > 1 ? 1 : a < 0 ? 0 : a;
        var b = k(),
            c = a * b.distance;
        return i[h] = c / b.distance * 100 + "%", this
    }
};
(function () {
    function a(a, b) {
        function d() {
            c && clearTimeout(c), c = null
        }
        function e() {
            return d(), c = setTimeout(a, b), this
        }
        function f() {
            return d(), this
        }
        var c = null;
        return {
            reset: e,
            stop: f,
            start: e
        }
    }
    Myspace.ResetTimer = a
})();
(function () {
    function b(a) {
        var b = new Date(a),
            e = new Date,
            f = {
                updatedTimeStamp: "",
                ingnore: !0
            }, g = e - b;
        if (g < 0) f.updatedTimeStamp = "just now";
        else {
            var h = new Date(g),
                i = h.getUTCFullYear() - 1970,
                j = h.getUTCMonth();
            if (i > 0 || j > 0) f.updatedTimeStamp = c(b);
            else {
                var k = h.getUTCDate();
                if (k > 1) k--, k == 1 ? (f.ingnore = !1, f.updatedTimeStamp = "Yesterday at " + d(b)) : f.updatedTimeStamp = c(b);
                else {
                    f.ingnore = !1;
                    var l = h.getUTCHours();
                    if (l > 0) f.updatedTimeStamp = l == 1 ? "1 hour ago" : l + " hours ago";
                    else {
                        var m = h.getUTCMinutes();
                        m == 0 ? f.updatedTimeStamp = "just now" : m == 1 ? f.updatedTimeStamp = "1 min ago" : f.updatedTimeStamp = m + " mins ago"
                    }
                }
            }
        }
        return f
    }
    function c(b) {
        var c = b.getDate(),
            e = b.getMonth(),
            f = b.getFullYear();
        return c = c < 10 ? "0" + c : c, a[e] + " " + c + ", " + f + " at " + d(b)
    }
    function d(a) {
        var b = a.getHours(),
            c = a.getMinutes(),
            d = b >= 12 ? "PM" : "AM";
        return b %= 12, b = b ? b < 10 ? "0" + b : b : 12, c = c < 10 ? "0" + c : c, b + ":" + c + " " + d
    }
    function e() {
        $("time[datetime][updated!='true'][pubdate!='true']").each(function () {
            var a = $(this),
                c = b(a.attr("datetime"));
            a.html("<b>" + c.updatedTimeStamp + "</b>"), c.ingnore && $(this).attr("updated", "true")
        })
    }
    var a = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
    setInterval(function () {
        e()
    }, 6e4), comm.listen("spaceway.page.complete,page.changed", function () {
        e()
    }, !0), e()
})();
(function () {
    function e(e) {
        d || (a = document.title, document.title = b = e, d = !0, c = setInterval(function () {
            var c = document.title === b;
            c || (a = document.title), document.title = c ? a : b
        }, 2e3))
    }
    function f() {
        d = !1, clearInterval(c), document.title === b && (document.title = a)
    }
    var a = "",
        b = "",
        c, d = !1;
    comm.listen("title.startflashing", e, !0), comm.listen("title.stopflashing", f, !0), scomm.add(function (a) {
        if (a !== "title.stopflashing") return;
        f()
    })
})();
(function (a) {
    function b(b, c) {
        c = c || !1, b.on("click", ".delete", function (b) {
            var c = a(b.currentTarget).closest(".notification"),
                f = c.data("isRequest"),
                g = c.data("renderTime"),
                h = c.data("notificationId");
            return f ? d("ignore", c.data("entityKey"), h) : e(h, g), j(i(c), "Invoke", "DeleteNotification"), !1
        }), b.on("click", "button", function (b) {
            var c = a(b.currentTarget),
                e = c.closest(".notification"),
                f = c.data("action"),
                g = e.data("notificationId");
            return d(f, e.data("entityKey"), g), !1
        }), b.on("click", ".notification", function (b) {
            var c = a(b.currentTarget);
            h(c, b)
        }), comm.listen("notifications.remove", function (a) {
            f(b, a)
        }, c)
    }
    function c(b) {
        var c = [],
            d = [],
            e = 0;
        b.each(function () {
            var b = a(this);
            if (!b.data("alreadyViewed")) {
                var f = b.data("notificationId"),
                    g = b.data("renderTime");
                g ? (d.push(f), e = Math.max(e, g)) : c.push(f), b.data("alreadyViewed", !0)
            }
        }), (d.length || c.length) && a.ajax({
            url: "/ajax/notifications/markviewed/v2",
            type: "POST",
            data: {
                aggregateNotificationIds: d,
                singleNotificationIds: c,
                renderTime: e
            }
        }).done(function (a) {
            comm.send("notifications.count", a), scomm.send("notifications.count", a)
        })
    }
    function d(b, c, d) {
        return a.ajax({
            url: "/ajax/connections/" + b,
            data: {
                entityKey: c
            },
            type: "POST"
        }).done(function () {
            comm.send("notifications.remove", d), scomm.send("notifications.remove", d)
        })
    }
    function e(b, c) {
        return a.ajax({
            url: "/ajax/notifications/delete",
            data: {
                notificationId: b,
                renderTime: c
            },
            type: "POST"
        }).done(function () {
            comm.send("notifications.remove", b), scomm.send("notifications.remove", b)
        })
    }
    function f(b, c) {
        b.find('.notification[data-notification-id="' + c + '"]').fadeOut(function () {
            a(this).remove(), comm.send("notifications.removed", c)
        })
    }
    function g(a) {
        var b = a.find("a.primaryLink");
        return b.length || (b = a.find(".notificationInfo > a").last()), b.length || (b = a.find(".notificationInfo > .subject > a").first()), b.length ? b : null
    }
    function h(b, c) {
        j(i(b), "Invoke", "ClickNotification");
        var d;
        c.target.nodeName === "A" ? d = a(c.target) : d = g(b);
        if (d) {
            var e = n(d);
            e && e(d), c.preventDefault(), c.stopPropagation()
        }
    }
    function i(a) {
        return a.closest("#notificationsPopout").length ? "notificationspopup" : a.closest("#toasts").length ? "notificationstoasts" : context.pfc
    }
    function j(a, b, c) {
        comm.send("track", new Tracking(a, b, c))
    }
    function l(a) {
        var b = a.attr("href");
        b && b !== "#" && comm.send("location.href", b)
    }
    function m(a) {
        var b = Myspace.PhotoCarouselLightbox,
            c = a.data("playlistId"),
            d = a.data("photoId"),
            e = a.data("ownerUsername");
        b.startCarousel({
            playlistId: c,
            mediaId: d,
            fetchMoreItemsUrl: "/ajax/" + e + "/photos/carousel/fetch"
        })
    }
    function n(a) {
        var b = a.data("object-type");
        return k[b] || l
    }
    scomm.add(function (a, b) {
        a === "notifications.remove" && comm.send(a, b)
    }), scomm.add(function (a, b) {
        a === "notifications.count" && comm.send(a, b)
    });
    var k = {
        image: m
    };
    Myspace.Notifications = Myspace.Notifications || {}, Myspace.Notifications.wireList = b, Myspace.Notifications.markAsViewed = c, Myspace.Notifications.onClick = h
})(jQuery);
(function (a) {
    function b(a) {
        var b = a.find(".commentBody"),
            c = b.find(".textWrapper"),
            d = Number(b.css("max-height").slice(0, -2)),
            e = c.height();
        e > d && a.addClass("expandable")
    }
    function c(c, d) {
        function s(c, d) {
            return a.ajax({
                url: "/ajax/comments/get/" + k,
                type: "POST",
                data: {
                    start: n,
                    max: c
                }
            }).done(function (c) {
                var e = c.nextStart,
                    h = a(c.html).filter(".comment"),
                    i = f[0].scrollHeight;
                g.prepend(h), h.each(function () {
                    var c = a(this);
                    b(c)
                }), h.addClass("newComment"), setTimeout(function () {
                    h.removeClass("newComment")
                }, 4e3);
                var j = f[0].scrollHeight - i - h.last().outerHeight(!0) - 30;
                f.scrollTop(j), m += h.length, r = m < o && e !== 0, n = e, comm.send("page.changed", g), d && d({
                    numShown: m,
                    hasMore: r
                })
            })
        }
        function t() {
            var b = a.trim(j ? i.val() : i.text());
            if (h) {
                var c = l && l.mentionProfileList();
                Object.keys(c).forEach(function (a) {
                    var d = c[a];
                    b = b.replace(d.text, "[[" + d.text + "]]")
                })
            }
            return b
        }
        function u() {
            var a = t().trim(),
                b = l && l.mentionProfileList();
            return b && Object.keys(b).forEach(function (c) {
                var d = b[c];
                a = a.replace("[[" + d.text + "]]", "[@" + d.userName + "|" + d.key + "]")
            }), a
        }
        function v() {
            j ? i.val("") : i.text(""), l && l.reset()
        }
        function w() {
            var c = u();
            c.length > 0 && !q && (q = !0, a.ajax({
                url: e.attr("action"),
                type: "POST",
                data: {
                    text: c
                }
            }).done(function (c) {
                var d = a(c);
                g.append(d), b(d), v(), f.animate({
                    scrollTop: f[0].scrollHeight
                }, {
                    duration: 500,
                    done: function () {
                        d.addClass("newComment"), setTimeout(function () {
                            d.removeClass("newComment")
                        }, 4e3)
                    }
                })
            }).always(function () {
                q = !1
            }).fail(function (a) {
                var b = JSON.parse(a.responseText).errorMessage || "There was a problem posting your comment, please try again later.";
                e.tip({
                    trigger: "manual",
                    classes: "error",
                    title: b
                }).tip("show"), setTimeout(function () {
                    e.tip("destroy")
                }, 4e3)
            }), comm.send("track", new Tracking("Comment", "Save", e.attr("data-type"))))
        }
        function x() {
            i.focus()
        }
        function y() {
            f.scrollTop(f.prop("scrollHeight"))
        }
        function z(b) {
            return a.ajax({
                url: "/ajax/comments/delete/" + k + "/" + b,
                type: "POST"
            })
        }
        function A(b) {
            return a.ajax({
                url: "/ajax/comments/spam/" + b,
                type: "POST"
            })
        }
        function B() {
            j ? i.prop("disabled", !1) : i.prop("contentEditable", !0), i.attr("placeholder", i.data("enabledPlaceholder"))
        }
        function C() {
            j ? i.prop("disabled", !0) : i.prop("contentEditable", !1), i.attr("placeholder", i.data("disabledPlaceholder"))
        }
        function D() {
            e.find(".signIn").click(function () {
                return comm.send("login.prompt", {
                    action: "comment",
                    object: k
                }), !1
            }), h && i.length && (l = Myspace.mention(i, i[0], p)), g.children(".comment").each(function () {
                b(a(this))
            }), f.on("click", ".comment .expand", function (b) {
                var c = a(b.currentTarget);
                return c.siblings(".commentBody").addClass("expanded"), c.remove(), !1
            }), f.on("click", ".comment .deleteComment", function (b) {
                function f() {
                    return window.setTimeout(function () {
                        comm.send("reportAbuse", {
                            type: "comment",
                            entityKey: d,
                            userEntityKey: a(b.currentTarget).data("authorEntityKey")
                        })
                    }, 700), !1
                }
                function g() {
                    z(d).always(function () {
                        c.remove()
                    })
                }
                var c = a(b.currentTarget).closest(".comment"),
                    d = c.data("entity-key"),
                    e = a(b.currentTarget),
                    h = e.data("canDelete"),
                    i = e.data("canReport");
                h && i ? Myspace.Confirm({
                    text: "What would you like to do with this comment?",
                    yes: {
                        text: "Delete",
                        onClick: g
                    },
                    no: {
                        text: "Report",
                        onClick: f
                    }
                }) : h ? Myspace.Confirm({
                    text: "Delete this comment?",
                    yes: {
                        onClick: g
                    }
                }) : i && f()
            }), f.on("click", ".comment .markAsSpam", function (b) {
                function e() {
                    A(d).always(function () {
                        c.remove()
                    })
                }
                var c = a(b.currentTarget).closest(".comment"),
                    d = c.data("entity-key");
                return Myspace.Confirm({
                    text: "Mark this comment as spam?",
                    yes: {
                        onClick: e
                    }
                }), !1
            }), i.keydown(function (a) {
                switch (a.which) {
                    case 13:
                        a.shiftKey || (a.preventDefault(), (!l || !l.isProfileSelectByEnterKey()) && w());
                        break;
                    case 27:
                        v()
                }
            }), e.data("canComment") ? B() : C(), comm.listen("connect.complete", function (a) {
                a.entityKey === k && (a.action === "add" ? B() : a.action === "remove" && C())
            }), c.data("commentsControl", this), c.data("commentsWired", !0)
        }
        d = d || {};
        if (c.data("commentsWired")) return c.data("commentsControl");
        var e = c.children("form"),
            f = c.find(".comments"),
            g = f.children("ol"),
            h = context.features.isMentionProfileEnabled,
            i = h ? e.find("div[contenteditable]") : e.find("textarea"),
            j = i[0] && i[0].tagName === "TEXTAREA",
            k = f.data("direct-object"),
            l, m = g.children().length,
            n = g.data("nextStart"),
            o = g.data("total"),
            p = d.rightRail,
            q = !1,
            r = m < o;
        D(), this.getMoreComments = s, this.focus = x, this.scrollToBottom = y
    }
    Myspace.CommentsControl = c
})(jQuery);
(function (a) {
    Myspace.DropDown = function (b, c) {
        function e(b) {
            function e() {
                b.addClass("open");
                var c = Math.max(a(window).height() + a(window).scrollTop() - b.offset().top - 120, 50);
                b.children("ul").css("max-height", c), setTimeout(function () {
                    a(document).on("click", f)
                }, 0)
            }
            function f() {
                b.children("ul").scrollTop(0), b.removeClass("open"), a(document).off("click", f)
            }
            function g() {
                h() ? f() : e()
            }
            function h() {
                return b.hasClass("open")
            }
            var d = b.data("event");
            b.children("strong").click(function () {
                g()
            }), b.on("click", "li", function () {
                var e = a(this),
                    g = b.find("strong .title"),
                    h = b.find("strong > span > i"),
                    i = e.text().trim(),
                    j = e.data("value"),
                    k = e.find("i").attr("class");
                if (c.eventTracking) {
                    var l = c.eventTracking.action ? typeof c.eventTracking.action == "function" ? c.eventTracking.action(e) : c.eventTracking.action : "Select: " + i,
                        m = c.eventTracking.label ? typeof c.eventTracking.label == "function" ? c.eventTracking.label(e) : c.eventTracking.label : undefined,
                        n = new Tracking(c.eventTracking.category || context.pfc, l, m);
                    comm.send("track", n)
                }
                b.find("li.selected").removeClass("selected"), g.text(i), h.attr("class", k), e.addClass("selected"), comm.send(d, {
                    value: j,
                    dropDownElement: b
                }), f()
            }), b.children("ul").on("mousewheel", function (a) {
                a.stopPropagation()
            }), comm.listen("spaceway.page.complete,dropdown.close", f)
        }
        function f() {
            d.each(function () {
                var b = a(this),
                    c = b.find("li:first-child"),
                    d = b.find("strong .title"),
                    e = b.find("strong > span > i"),
                    f = c.text().trim(),
                    g = c.data("value"),
                    h = c.find("i").attr("class");
                b.find("li.selected").removeClass("selected"), d.text(f), e.attr("class", h), c.addClass("selected")
            })
        }
        function g(b, c) {
            d.each(function () {
                var d = a("<li></li>").text(b).data("value", c);
                a(this).children("ul").append(d)
            })
        }
        function h(b) {
            d.each(function () {
                a(this).children("ul").children().each(function () {
                    var c = a(this);
                    c.data("value") == b && c.remove()
                })
            })
        }
        function i(b, c) {
            d.each(function () {
                a(this).children("ul").children().each(function () {
                    var d = a(this);
                    d.data("value") == b && d.data("value", c.value).text(c.name)
                })
            })
        }
        function j(b) {
            var c = !1;
            d.each(function () {
                var d = a(this),
                    e = d.find("strong .title"),
                    f = d.find("strong > span > i");
                d.children("ul").children().each(function () {
                    var g = a(this);
                    if (g.data("value") == b) {
                        var h = g.find("i").attr("class"),
                            i = d.data("event");
                        g.addClass("selected"), e.text(g.text()), f.attr("class", h), c = !0;
                        return
                    }
                }), c && d.find("li.selected").removeClass("selected")
            })
        }
        function k() {
            var b = [];
            return d.each(function () {
                var c = a(this);
                c.children("ul").children().each(function () {
                    b.push(a(this).data("value"))
                })
            }), b
        }
        c = c || {};
        var d = a(b);
        return d.each(function () {
            e(a(this))
        }), {
            addItem: g,
            removeItem: h,
            modifyItem: i,
            selectItem: j,
            getValues: k,
            reset: f
        }
    }
})(jQuery);
(function (a) {
    Myspace.Influencer = new function () {
        function b(a) {
            var b = "",
                c = a.closest("[data-influencer]");
            return c.length && (b = c.data("influencer")), b == context.profileId && (b = ""), b
        }
        return sessionStorage.influencer = "", a("body").delegate("a", "click", function (b) {
            var c = a(this).closest("[data-influencer]");
            c.length && c.data("influencer") != context.profileId ? sessionStorage.influencer = c.data("influencer") : sessionStorage.influencer = ""
        }), a(window).bind("popstate", function (a) {
            sessionStorage.influencer = ""
        }), comm.listen("influencer.click", function (c) {
            var d;
            typeof c == "number" ? d = c : d = b(a(c)), context.lastInfluencer = d, setTimeout(function () {
                context.lastInfluencer = null
            }, 100)
        }, !0), {
            getClickInfluencer: b
        }
    }
})(jQuery);
(function (a, b) {
    function c(c, d) {
        var e = [],
            f = null;
        return a(".playBtn.song, .playBtn.video", c).each(function (c, g) {
            var h = objectify(a(g));
            h.influencerId = b.Influencer.getClickInfluencer(a(g)), d && d == g && (f = h), e.push(h)
        }), {
            media: e,
            selected: f
        }
    }
    function j(b, c) {
        a(".playBtn").removeClass("playing paused");
        if (b && b.mediaItem) {
            var d = a("#queue .list." + b.mode + " .selected .playBtn");
            if (d.length) {
                var e = a('.playBtn[data-media-id="' + b.mediaItem.mediaId + '"]:not(#footer .playBtn)'),
                    f = b.paused ? "paused" : "playing";
                e.add(d).addClass(f)
            }
        }
    }
    function k(a, b) {
        comm.send("track", new Tracking("playButton", a, b))
    }
    function l() {
        e || (e = new b.Dialog(a("#videoNotSupported"))), e.show()
    }
    function m(c, d) {
        f || (f = new b.Dialog(g));
        var e = [],
            h = a('<button class="radio">Start Radio</button>');
        g.find(".media").html('<a><img src="' + c.imageUrl + '"/></a><div><h1>' + c.title + "</h1>" + (c.artistName ? "<h2>" + c.artistName + "</h2>" : "") + "</div>"), h.click(function () {
            i.radio(c), k("play", "radio"), f.hide()
        }), e.push(h), g.find(".media").find("div").append(e), f.show()
    }
    var d = a("html").hasClass("mobile"),
        e, f, g = d ? a("#radioForMedia") : null,
        h = a("#wrap"),
        i = {
            song: function (a, b) {
                var d = b.closest("ol.table"),
                    e = a.private ? "preview" : "queue";
                if (d.length) {
                    var f = c(d, b[0]);
                    comm.send(e + ".set", {
                        media: f.media,
                        selected: f.selected,
                        listId: d.attr("data-objectversion") || d.attr("data-uid") || h.attr("data-uid")
                    })
                } else comm.send(e + ".play.song", a)
            },
            album: function (a) {
                comm.send("queue.set.album", a)
            },
            mixtape: function (a) {
                context.lastInfluencer = a.influencerId, a.influencerId = a.profileId, comm.send("queue.set.mixtape", a)
            },
            radio: function (a) {
                comm.send("radio.start", a)
            },
            video: function (a) {
                comm.send("influencer.click", a.influencerId), comm.send("videoLightbox.instance", function (c) {
                    c ? c.show(a) : (context.pfc !== "videodetail" && (b.videoReferrer = window.location.pathname), comm.send("location.href", a.detailUrl))
                })
            },
            all: function (b, d) {
                var e = d.data("list-selector"),
                    f = e ? a(e) : h,
                    g = c(f);
                g && g.media && g.media.length && comm.send("queue.set", {
                    media: g.media,
                    selected: g.selected,
                    listId: h.attr("data-uid")
                })
            }
        };
    a("body").delegate(".playBtn, #playAll", "click", function (c) {
        var e = this,
            f = a(this),
            g = objectify(f);
        c.preventDefault(), c.stopPropagation();
        if (f.hasClass("playing")) return comm.send("player.pause"), k("pause", g.type), !1;
        if (f.hasClass("paused")) return comm.send("player.resume"), k("resume", g.type), !1;
        g.influencerId = b.Influencer.getClickInfluencer(f);
        if (d) {
            if (g.type === "video") return l();
            if (g.type === "song" && g.isPremium === !0 || g.type === "album" || g.type === "mixtape") return m(g, f)
        }
        i[g.type](g, f), k("play", g.type)
    }), comm.listen({
        player: {
            "+preloading": j,
            "+loading": j,
            "+loaded": j,
            "+paused": j,
            "+resumed": j,
            "+state": j,
            "+ended": function () {
                j()
            },
            "+stopped": function () {
                j()
            }
        }
    })
})(jQuery, window.Myspace = window.Myspace || {});
var play = function (a, b, c) {
    b.type || (b.type = a), c = c || "play_25";
    var d = '<button class="playBtn ' + c + " " + a + '" ' + attributify(b) + "></button>";
    return d
};
var Myspace = Myspace || {};
Myspace.ExQ = function (a) {
    function d(a, c) {
        a.command = c;
        var d = a.playlistId;
        !b[d] || !b[d].data || !b[d].data.length ? (b[d] || (b[d] = {}, b[d].objectVersion = a.objectVersion), b[d].data = [], b[d].data.push(a), e(b[d].objectVersion, b[d].data[0])) : b[d].data.push(a)
    }
    function e(a, b) {
        var d, e;
        b.command == "mix.changeImage" ? b.changeImage(a) : (d = c[b.command], b.objectVersion = a, typeof b.onSuccess == "function" && (e = b.onSuccess, delete b.onSuccess), typeof b.source != "undefined" && delete b.source, typeof b.item != "undefined" && delete b.item, h(d, "POST", b, function (a) {
            e && e(a), f(a)
        }))
    }
    function f(a) {
        if (a.playlist) {
            var c = a.playlist.playlistId;
            b[c] && (b[c].data.length && b[c].data.shift(), a.playlist.objectVersion && (b[c].objectVersion = a.playlist.objectVersion), b[c].data.length && e(b[c].objectVersion, b[c].data[0]))
        }
    }
    function g(a) {
        b[a.playlistId] || (b[a.playlistId] = {}), b[a.playlistId].objectVersion = a.objectVersion
    }
    function h(b, c, d, e) {
        var f = {
            url: b,
            data: d,
            type: c,
            success: function (a) {
                e && e(a)
            },
            errorSettings: {
                yes: {
                    onClick: function () {
                        a.save(f)
                    }
                },
                no: {
                    text: "Reload",
                    onClick: function () {
                        comm.send("location.href", window.location.href)
                    }
                }
            }
        };
        return a.save(f)
    }
    var b = {}, c = {
            "mix.addItem": "/ajax/mixes/additem",
            "mix.removeItem": "/ajax/mixes/removeitem",
            "mix.moveItem": "/ajax/mixes/moveitem",
            "mix.edit": "/ajax/mixes/edit",
            "mix.delete": "/ajax/mixes/delete",
            "mix.removeCover": "/ajax/mixes/removecover"
        };
    return {
        process: d,
        executeAsync: e,
        executeSerial: f,
        updateObjectVersion: g,
        sendAjax: h
    }
}(jQuery);
(function (a) {
    function h(a, b) {
        function e() {
            a.onCancel && !c && a.onCancel(), comm.stopListening("dialog.hiding", e)
        }
        var c;
        Myspace.Confirm({
            text: "Are you sure you want to delete '" + a.title + "'?<br />Any photos added to this mix will be deleted.",
            yes: {
                onClick: function () {
                    a.onCancel && delete a.onCancel, c = !0, b = "mix.delete", a.playlistId = a.playlistId || a.id.split(",")[1], a.objectVersion = 1, a.onSuccess = a.onSuccess || function (b) {
                        b.entityKey = a.entityKey, comm.send("mix.deleted", b)
                    }, d(a, b)
                }
            }
        }), comm.listen("dialog.hiding", e)
    }
    function i(a) {
        g("/ajax/mixes/move", "POST", a, function (a) {})
    }
    function j(a) {
        comm.send("toasts.new", {
            html: '<li><a href="/' + a.playlist.profile.username + "/mixes/" + seofy(a.playlist.title) + "-" + a.playlist.playlistId + '">Sweet! Your new mix "' + a.playlist.title + '" has been created!</a></li>',
            timeout: 1e4
        })
    }
    function k(b, c, d) {
        var e, f;
        b = b || {}, b.emptyPlaylistImage = config.urls.emptyPlaylistImage, b.mediaType || (b.type === "song" ? b.mediaType = "Audio" : b.type === "video" ? b.mediaType = "Video" : b.mediaType = b.type), a("#mixForm").remove(), f = a(require("ejs").render(templates["areas/mixes/views/dialogs/mixForms"], {
            mixtape: b,
            command: c
        })), f.appendTo("#container"), e = new Myspace.Dialog(f), e.show(), c === "mix.selectAndAddItem" ? (d && d(), m(b, e)) : l(b, e)
    }
    function l(b, c) {
        var f, g, h, i, j, k, l, o = a("#mixForm"),
            p = a("#createForm"),
            q;
        p.show();
        if (!p.data("wired")) {
            g = a("#mixtapeImageContainer"), h = g.find(".mixtapeImage"), i = a("#mixCoverFile"), j = a("#mixTitle"), k = a("#mixDescription"), l = k.siblings(".charCount");
            var r = {
                autoUpload: !1,
                filesInput: i,
                uploadBegin: function () {
                    g.tip("hide")
                },
                uploadComplete: function () {},
                showPreview: function (a) {
                    f = h.attr("src"), h.attr("src", a), i.data("hasImage", !0)
                },
                fileAttached: function () {
                    g.tip({
                        title: "The image was attached.",
                        trigger: "manual",
                        placement: "inside right"
                    }).tip("addOKCustomClass").tip("show")
                },
                fileProcessFailed: function (a) {
                    this.handleUploadError(a)
                },
                showLoading: function () {
                    g.addClass("loading white")
                },
                hideLoading: function () {
                    g.removeClass("loading white")
                },
                handleUploadError: function (a) {
                    this.hideLoading(), g.tip({
                        title: a,
                        trigger: "manual",
                        placement: "inside right"
                    }).tip("addErrorCustomClass").tip("show"), i.data("hasImage", !1)
                },
                executeSerial: e
            };
            Myspace.MixCoverUploader.init(r), k.keyup(function (a) {
                var b = 600,
                    c = k.val().length;
                if (c > b) return k.val(k.val().substring(0, b)), c = b, !1;
                l.html(c + "/" + b).attr("data-len", c)
            }), o.find(".create").click(function (e) {
                e.preventDefault(), q = !0, b.onCancel && delete b.onCancel;
                var f, g = a(e.target),
                    h = i.data("hasImage") == 1;
                g.attr("disabled", "disabled");
                if (a.trim(j.val()) === "") return j.siblings(".tipHolder").tip({
                        title: "The mix title is required",
                        trigger: "manual",
                        placement: "inside top"
                    }).tip("addErrorCustomClass").tip("show"), j.keyup(function () {
                        g.removeAttr("disabled"), j.siblings(".tipHolder").unbind("keyup").tip("hide")
                    }), !1;
                b.onSuccess && (f = b.onSuccess, delete b.onSuccess), b.onSuccess = function (a) {
                    a.hasImage = h, comm.send("mix.created", a), f && f(j.val()), h && (a.playlist.changeImage = function (b) {
                        Myspace.MixCoverUploader.startUpload(a.playlist.playlistId, b)
                    }, d(a.playlist, "mix.changeImage"))
                }, n(o, b), c.hide()
            }), o.find(".cancel").click(function (a) {
                c.hide()
            }), o.find(".myMixes").click(function (a) {
                a.preventDefault(), p.hide(), m(b, c)
            });

            function s() {
                b.onCancel && !q && b.onCancel(), comm.stopListening("dialog.hiding", s)
            }
            comm.listen("dialog.hiding", s)
        } else p.data("wired", !0)
    }
    function m(b, c) {
        var e = a("#addToSection"),
            f = a("#myMixtapes"),
            g = f.find("option:selected"),
            h = a("#selectedMixImage").children("img");
        e.show(), e.data("wired") ? e.data("wired", !0) : (f.change(function (a) {
            g = f.find("option:selected"), h.attr("src", g.data("image"))
        }), e.find(".cancel").click(function () {
            return c.hide(), !1
        }), e.find(".save").click(function (a) {
            a.preventDefault(), g = f.find("option:selected");
            var e = g.text();
            e = e.length > 30 ? e.substr(0, 30) + "..." : e, b.playlistId = g.val(), b.objectVersion = g.data("objectversion"), b.onSuccess = function (a) {
                typeof a == "object" && (comm.send("table.newItem", a), comm.send("toasts.new", {
                    html: "<li>" + b.title + "<br />was added to<br />" + e + "</li>",
                    timeout: 3e3
                }))
            }, d(b, "mix.addItem"), c.hide()
        }), e.find(".createMixAndAdd").click(function () {
            return e.hide(), l(b, c), !1
        }))
    }
    function n(a, b) {
        g("/ajax/mixes/create", "POST", a.serialize(), function (a) {
            typeof b.onSuccess == "function" && typeof a.playlist == "object" && b.onSuccess(a)
        })
    }
    function o(a, b) {
        g("/ajax/" + a.profileId + "/mixes/getmarkup", "POST", {
            playlistId: a.playlistId,
            profileId: a.profileId
        }, function (a) {
            var b = {};
            b.markup = a, comm.send("mix.created", b)
        })
    }
    function p(b) {
        function e() {
            d.data("confirmed") || comm.send("track", new Tracking("playerQueue", "save", "cancelled")), comm.stopListening("dialog.hiding", e)
        }
        var d = a("#addItemsToMix");
        d.length || (d = a(require("ejs").render(templates["areas/mixes/views/dialogs/addItemsToMix"])), d.submit(function (a) {
            d.data("confirmed", !0), comm.stopListening("dialog.hiding", e), a.preventDefault(), r(d, b), comm.send("track", new Tracking("playerQueue", "save", "newMix"))
        }), d.on("click", "ul", function (c) {
            c.preventDefault(), a(c.target).closest("li").length && d.data("confirmed", !0), q(c, b, e)
        }), d.appendTo("body"), c = new Myspace.Dialog(d)), d.data("confirmed", !1), g("/ajax/mixes/get", "POST", null, function (b) {
            var e = "";
            if (b.length == 0) {
                d.addClass("noMixes");
                return
            }
            for (var f = 0; f < b.length; f++) {
                var g = b[f].songCount == 1 ? " song" : " songs";
                e += '<li data-playlist-id="' + b[f].playlistId + '" data-object-version="' + b[f].objectVersion + '"><img src="' + b[f].image + '" /><div><span class="title">' + b[f].title + "</span><span>" + b[f].songCount + g + "</span></div></li>"
            }
            a(".addToExisting > ul", d).html(e).css("overflow-y", b.length > 12 ? "scroll" : "auto"), d.removeClass("noMixes"), c.center()
        }), c.show(), d.find("input").val("").focus(), comm.listen("dialog.hiding", e)
    }
    function q(b, e) {
        var f, g = a(b.target).closest("li");
        if (g.length) {
            var h = objectify(g);
            f = {
                playlistId: h.playlistId,
                objectVersion: h.objectVersion,
                mediaItems: e
            }, f.onSuccess = function (a) {
                if (typeof a == "object") {
                    var b = 0,
                        c;
                    a.playlist && a.playlist.itemsAffected && (b = a.playlist.itemsAffected.length), b == 1 ? c = " item was added to " : c = " items were added to ", comm.send("table.newItem", a), comm.send("toasts.new", {
                        html: "<li>" + b + c + "  <br />" + g.find(".title").text() + "</li>",
                        timeout: 3e3
                    })
                }
            }, d(f, "mix.addItem"), c.hide(), comm.send("track", new Tracking("playerQueue", "save", "addToMix"))
        }
        return !1
    }
    function r(a, b) {
        var d = a.find("input").val();
        return d.length && (g("/ajax/mixes/create", "POST", {
            title: d,
            mediaItems: b
        }, function (a) {
            a.playlist && comm.send("mix.created", a)
        }), c.hide()), !1
    }
    function s(a, b) {
        var c = "/ajax/connections/" + a,
            d = {
                entityKey: b.entityKey,
                type: b.type,
                id: b.id,
                optionalData: b.optionalData
            };
        g(c, "POST", d, b.onSuccess, b.onError).done(function () {
            var b = {
                action: a,
                entityKey: d.entityKey
            };
            comm.send("connect.complete", b), scomm.send("connect.complete", b)
        })
    }
    function u(a, b) {
        var c = Myspace.PhotoCropper,
            d = Myspace.Upload.MEDIA_TYPES.PROFILE,
            e = a.item;
        c.setOptions({
            photoUrl: a.fullImageUrl,
            photoType: d,
            photoDimensions: {
                width: a.fullImageWidth,
                height: a.fullImageHeight
            },
            successCallback: function (a) {
                e.hide(), b(a)
            },
            failedCallback: function (a) {
                var b = Myspace.Upload.MapServerError(a.errorCode);
                w(b, d)
            }
        }, function () {
            c.show()
        })
    }
    function v(a, b) {
        var c = a.item,
            d = {
                utoken: context.hashMashter,
                url: a.fullImageUrl,
                photoType: Myspace.Upload.MEDIA_TYPES.COVER
            };
        Myspace.Upload.PosterUpload(d, d.photoType, function (a) {
            c.slideUp(), b(a)
        })
    }
    function w(b, c) {
        t = !1, a("#sidebar .mediaSquare").removeClass("photoObject loading"), Myspace.Confirm({
            closeAll: !1,
            text: Myspace.Upload.GetErrorMessage(null, b, c),
            yes: {
                text: "OK"
            },
            no: !1
        })
    }
    function x(a, b, c) {
        var d = {
            imageType: b,
            imageId: a.id,
            albumId: a.albumId
        };
        g("/ajax/editprofile/updateimage", "POST", d, function (a) {
            c(a)
        })
    }
    var b = Myspace.ExQ,
        c, d = b.process,
        e = b.executeSerial,
        f = b.updateObjectVersion,
        g = b.sendAjax;
    comm.listen("mix.imageChanged", f, !0), comm.listen("mix.coverUploadInit", function (a) {
        a.executeSerial = e, Myspace.MixCoverUploader.init(a)
    }, !0), comm.listen("mix.edit,mix.changeImage,mix.addItem,mix.removeItem,mix.moveItem,mix.removeCover", d, !0), comm.listen("mixtape.delete,mix.delete", h, !0), comm.listen("mix.move", i, !0), comm.listen("mix.created", j, !0), comm.listen("mix.create", k, !0), comm.listen("mix.addConnected", function (a, b) {
        setTimeout(function () {
            o(a, b)
        }, 1e3)
    }, !0), comm.listen("mix.addItems", p, !0), comm.listen("mix.selectAndAddItem", function (b, c) {
        var d, e = a("#mixes").find(".mix").length === 0;
        b.mediaId || (b.mediaId = b.id), b.releaseId || (b.releaseId = b.mediaReleaseId), e || (d = function () {
            g("/ajax/mixes/get", "POST", null, function (b) {
                var c = "",
                    d, e = b.length,
                    f = a("#myMixtapes");
                e > 0 && b[0].image && a("#selectedMixImage").children("img").attr("src", b[0].image).removeClass("hide");
                for (d = 0; d < e; d++) c += '<option value="' + b[d].playlistId + '" data-objectversion="' + b[d].objectVersion + '" data-image="' + b[d].image + '">' + b[d].title + "</option>";
                e && f.html(c)
            })
        }), comm.send("hide.hcard"), c == "mix.selectAndAddItem" && (e && (c = "mix.create"), k(b, c, d))
    }, !0), comm.listen("connect", function (b) {
        if (b.type == "song") {
            var c = a(b.item),
                d = c.data("uid"),
                e;
            d ? e = a('.playBtn[data-uid="' + d + '"]') : e = c.parents(".mediaSquare").find(".playBtn");
            if (e.length) {
                var f = objectify(e);
                f.songReleaseEntityKey ? b.optionalData = {
                    songReleaseEntityKey: f.songReleaseEntityKey
                } : b.optionalData = {
                    songReleaseId: f.mediaReleaseId
                }
            }
        } else if (b.type == "photo") {
            var c = a(b.item),
                g = c.data("mixEntityKey");
            g && (b.optionalData = {
                mixEntityKey: g
            })
        } else b.connectActionOrigin && (b.type == "profile" || b.type == "artist" || b.type == "mixtape") && (b.optionalData = {
                connectActionOrigin: b.connectActionOrigin
            });
        s("add", b)
    }, !0), comm.listen("disconnect", function (a) {
        a.connectActionOrigin && (a.type == "profile" || a.type == "artist" || a.type == "mixtape") && (a.optionalData = {
            connectActionOrigin: a.connectActionOrigin
        }), s("remove", a)
    }, !0), comm.listen("approveRequest", function (b) {
        s("approve", b), b.item.closest(".mediaSquare").parent().fadeOut(500, function () {
            a(this).remove()
        })
    }, !0), comm.listen("ignoreRequest", function (b) {
        s("ignore", b), b.item.closest(".mediaSquare").parent().fadeOut(500, function () {
            a(this).remove()
        })
    }, !0), comm.listen("block", function (a) {
        s("block", a)
    }, !0), comm.listen("unblock", function (a) {
        s("unblock", a)
    }, !0), scomm.add(function (a, b) {
        a == "connect.complete" && comm.send(a, b)
    }), comm.listen("connect>queue", function (b) {
        var c = {}, d = b.source.parents(".media,.mediaSquare,.streamItem").find(".playBtn");
        !d.length && b.uid && (d = a('.playBtn[data-uid="' + b.uid + '"]'));
        if (d.length) {
            c = objectify(d);
            var e = Myspace.Influencer.getClickInfluencer(b.source);
            c.type == "mixtape" ? (context.lastInfluencer = e, c.influencerId = c.profileId) : c.influencerId = e
        } else c = b.id;
        comm.send("queue.append." + b.type, c)
    }, !0), comm.listen("playRadio", function (b) {
        var c = a('.playBtn[data-uid="' + b.uid + '"]'),
            d;
        if (c.length) {
            var e = objectify(c);
            d = {
                radioStationEntityKey: e.radioStationEntityKey,
                name: e.name || e.title,
                imageUrl: e.imageUrl
            }
        } else b.radioStationEntityKey && (d = {
                radioStationEntityKey: b.radioStationEntityKey,
                name: b.title,
                imageUrl: b.imageUrl
            });
        comm.send("radio.start", d)
    }, !0), comm.listen("updateProfileSong", function (b) {
        var c = objectify(a('.playBtn[data-uid="' + b.uid + '"]')),
            d = a("#profileWidget"),
            e = context.displayProfileId == context.profileId && d.length,
            f = {
                songId: c.mediaId,
                songReleaseId: c.mediaReleaseId,
                includeTemplate: e
            };
        g("/ajax/editprofile/updatesong", "POST", f, function (b) {
            if (b.success) {
                comm.send("profile.objectversion", b.objectVersion);
                if (e && b.songTemplate) {
                    var d = require("ejs").compile(b.songTemplate),
                        f = a(d({
                            song: c
                        })),
                        g = a("#profileSong");
                    g.length ? g.html(f.children()) : a("#profileDetails").append(f)
                }
            }
        })
    }, !0), comm.listen("photo.delete", function (a) {
        function d() {
            g("/ajax/photos/photo/delete", "POST", b, function (b) {
                a.source.closest("li.item").remove(), comm.send("photo.deleted", a)
            })
        }
        var b = {
            entityKey: a.entityKey
        }, c = "";
        return a.id == context.profileImageId && a.id == context.coverImageId ? c = "Delete this photo?  The photo you are trying to delete is also your profile and cover photo.  If you proceed, your profile and cover photos will also be deleted." : a.id == context.profileImageId ? c = "Delete this photo?  The photo you are trying to delete is also your profile photo.  If you proceed, your profile photo will also be deleted." : a.id == context.coverImageId ? c = "Delete this photo?  The photo you are trying to delete is also your cover photo.  If you proceed, your cover photo will also be deleted." : c = "Delete this photo?", Myspace.Confirm({
            text: c,
            yes: {
                onClick: d
            },
            closeAll: !1
        }), !1
    }, !0);
    var t;
    comm.listen("connect>makeProfilePicture", function (b) {
        if (t) return;
        t = !0;
        var c = function (b) {
            comm.send("profile.objectversion", b.objectVersion), t = !1, context.profileImageId = b.imageId, new Myspace.genericDialog({
                buttons: !1,
                close: !1,
                classes: "success",
                html: '<section><p><i class="check_12_green"></i> Image successfully updated</p></section>'
            }), a("#sidebar .mediaSquare").removeClass("photoObject loading"), b.urls && b.urls.length && (context.displayProfileId ? context.displayProfileId == context.profileId && a("#sidebar > header > .item > .mediaSquare > a > img").attr("src", b.urls[2].url) : a("#sidebar > header > h1 > a > img").attr("src", b.urls[4].url))
        };
        a("#sidebar .mediaSquare").addClass("photoObject loading"), b.fromProfileMix ? x(b, "profile", c) : b.profileEligible && b.fullImageUrl ? u(b, c) : w(Myspace.Upload.ERROR_CODES.MINIMUM_IMAGE_SIZE, Myspace.Upload.MEDIA_TYPES.PROFILE)
    }, !0), comm.listen("connect>makeProfileCover", function (b) {
        if (t) return;
        t = !0;
        var c = function (b) {
            comm.send("profile.objectversion", b.objectVersion), t = !1, context.coverImageId = b.imageId, new Myspace.genericDialog({
                buttons: !1,
                close: !1,
                classes: "success",
                html: '<section><p><i class="check_12_green"></i> Image successfully updated</p></section>'
            }), b.urls && b.urls.length && context.pfc == "Profile" && context.displayProfileId == context.profileId && a("#background").css("background-image", "url('" + b.urls[0].url + "')")
        };
        b.fromCoverMix ? x(b, "cover", c) : b.coverEligible && b.fullImageUrl ? v(b, c) : w(Myspace.Upload.ERROR_CODES.MINIMUM_IMAGE_SIZE, Myspace.Upload.MEDIA_TYPES.COVER)
    }, !0), comm.listen("photoCropper.canceled", function () {
        t = !1, a("#sidebar .mediaSquare").removeClass("photoObject loading")
    }), comm.listen("username.changed", function (b) {
        a("#sidebar > header > h1 > a").attr("href", "/" + b)
    }, !0)
})(jQuery);
(function () {
    function g(d) {
        return c = 0, b = !1, a.removeClass("dragging files"), comm.send("files.dropped", d), !1
    }
    function h() {
        if (f) return;
        f = !0;
        var a = e.shift();
        i(a)
    }
    function i(a) {}
    var a = $(document.body),
        b, c = 0,
        d, e = [],
        f;
    $.event.add(document.body, "drop", g), $.event.add(document.body, "dragenter dragleave", function (d) {
        return d.type == "dragenter" ? c++ : d.type == "dragleave" && c--, !b && c > 0 ? (b = !0, a.addClass("dragging files"), comm.send("files.enterDocument", d.originalEvent.dataTransfer.items)) : c == 0 && (b = !1, a.removeClass("dragging files"), comm.send("files.leaveDocument", d.originalEvent.dataTransfer.items)), !1
    }), comm.listen("files.select,files.selectone", function (a, b) {
        d || (d = $("<input id=fileInput type=file style='left:-1000px;position:absolute;'>").hide().appendTo(document.body).bind("change", function (b) {
            d.hide(), a && a(b.target.files), d.val("")
        }));
        var c = b == "file.selectone";
        d.attr("multiple", c ? null : "multiple").show().click()
    }, !0), comm.listen("files.queue", function (a) {
        e.concat(a), $("#test1").html(JSON.stringify(e, "	")), h()
    }, !0)
})();
var Myspace = Myspace || {};
(function (a) {
    Myspace.SortManager = function (b) {
        function i() {
            h.$elem.bind("dragstart", function (a) {
                k(a)
            }), h.$elem.bind("dragend", function (a) {
                l(a)
            })
        }
        function j() {
            h.$elem.children('li:not([data-sortable="true"]):not("' + h.ignoreSelectors + '")').each(function () {
                var b = a(this);
                b.bind("dragenter", function (a) {
                    c && m(a)
                }), b.bind("dragover", function (a) {
                    c && n(a)
                }), b.bind("dragleave", function (a) {
                    c && o(a)
                }), b.bind("drop", function (a) {
                    c && p(a)
                }), b.attr("data-sortable", "true")
            })
        }
        function k(b) {
            if (Myspace.DragDropManager && Myspace.DragDropManager.isBeingDragged()) return !1;
            var g;
            return f = !1, j(), c = a(b.target).closest("li"), c.removeClass("transp"), d = e = c.index(), g = b.originalEvent.dataTransfer, g.setData("Text", h.dragText(b, c)), g.effectAllowed = "copy", g.dropEffect = "copy", g.setDragImage(c[0], 20, 20), h.dragStart(b, c), !1
        }
        function l(a) {
            return a.preventDefault(), !f && d !== e && r(e), h.dragEnd(a, c), c.removeClass(h.activeClass), c = null, s.reset(), !1
        }
        function m(b) {
            b.preventDefault();
            var d = a(b.target).closest("li");
            if (d[0] == c[0]) return !1;
            s.enter(function () {
                q(d)
            })
        }
        function n(a) {
            a.preventDefault();
            var b = a.originalEvent.dataTransfer;
            return b.dropEffect = "copy", !1
        }
        function o(b) {
            b.preventDefault();
            var d = a(b.target).closest("li");
            if (d[0] == c[0]) return !1;
            s.leave(function () {})
        }
        function p(a) {
            return a.preventDefault(), d === e ? !1 : (f = !0, h.drop && h.drop(a, c), !1)
        }
        function q(a) {
            var b = a.index();
            b === 0 ? a.before(c) : b < d ? a.before(c) : b > d && a.after(c), a.addClass(h.hoverSupressorClass), c.addClass(h.activeClass), d = b
        }
        function r(a) {
            q(h.$elem.children("li:eq(" + a + ")"))
        }
        function t() {
            h.$elem.unbind("dragend").unbind("dragstart")
        }
        var c, d, e, f = !1,
            g = function () {}, h = {
                $elem: b.$elem,
                ignoreSelectors: b.ignoreSelectors,
                activeClass: b.activeClass || "",
                hoverSupressorClass: b.hoverSupressorClass || "",
                helperClass: b.helperClass || "",
                dragText: b.dragText || g,
                dragStart: b.dragStart || g,
                dragEnd: b.dragEnd || g,
                drop: b.drop || g,
                dragEnter: b.dragEnter || g,
                dragLeave: b.dragLeave || g
            }, s = {
                count: 0,
                enter: function (a) {
                    !this.count && a && a(), this.count++
                },
                leave: function (a) {
                    this.count--, !this.count && a && a()
                },
                reset: function () {
                    this.count = 0
                }
            };
        return i(), {
            rebind: i,
            unbind: t
        }
    }
})(jQuery);
! function (a) {
    "use strict";
    var b = function (a, b) {
        this.init("tip", a, b)
    }, c = /in/;
    b.prototype = {
        constructor: b,
        init: function (b, c, d) {
            var e, f;
            this.type = b, this.$element = a(c), this.options = this.getOptions(d), this.enabled = !0, this.options.trigger != "manual" && (e = this.options.trigger == "hover" ? "mouseenter" : "focus", f = this.options.trigger == "hover" ? "mouseleave" : "blur", this.$element.on(e + "." + this.type, this.options.selector, a.proxy(this.enter, this)), this.$element.on(f + "." + this.type, this.options.selector, a.proxy(this.leave, this))), this.options.selector ? this._options = a.extend({}, this.options, {
                trigger: "manual",
                selector: ""
            }) : this.fixTitle()
        },
        getOptions: function (b) {
            return b = a.extend({}, a.fn[this.type].defaults, b, this.$element.data()), b.delay && typeof b.delay == "number" && (b.delay = {
                show: b.delay,
                hide: b.delay
            }), b
        },
        enter: function (b) {
            var c = a(b.currentTarget)[this.type](this._options).data(this.type);
            if (!c.options.delay || !c.options.delay.show) return c.show();
            clearTimeout(this.timeout), c.hoverState = "in", this.timeout = setTimeout(function () {
                c.hoverState == "in" && c.show()
            }, c.options.delay.show)
        },
        leave: function (b) {
            var c = a(b.currentTarget)[this.type](this._options).data(this.type);
            if (!c.options.delay || !c.options.delay.hide) return c.hide();
            clearTimeout(this.timeout), c.hoverState = "out", this.timeout = setTimeout(function () {
                c.hoverState == "out" && c.hide()
            }, c.options.delay.hide)
        },
        show: function () {
            var b, d, e, f, g, h, i, j;
            if (this.hasContent() && this.enabled) {
                b = this.tip(), this.setContent(), b.attr("data-name", this.getTipName()), j = this.$element.attr("data-tip-class"), j = j || this.options.classes, this.options.animation && b.addClass("fade"), h = typeof this.options.placement == "function" ? this.options.placement.call(this, b[0], this.$element[0]) : this.options.placement;
                if (h === !1) return;
                d = c.test(h), b.remove().css({
                    top: 0,
                    left: 0,
                    display: "block"
                }).appendTo(d ? this.$element : document.body), e = this.getPosition(d), f = b[0].offsetWidth, g = b[0].offsetHeight;
                switch (d ? h.split(" ")[1] : h) {
                    case "bottom":
                        i = {
                            top: e.top + e.height,
                            left: e.left + e.width / 2 - f / 2
                        };
                        break;
                    case "top":
                        i = {
                            top: e.top - g,
                            left: e.left + e.width / 2 - f / 2
                        };
                        break;
                    case "left":
                        i = {
                            top: e.top + e.height / 2 - g / 2,
                            left: e.left - f
                        };
                        break;
                    case "right":
                        i = {
                            top: e.top + e.height / 2 - g / 2,
                            left: e.left + e.width
                        }
                }!d && (i.left + f > a(window).width() || i.top < 10) && (i = {
                    top: e.top + e.height / 2 - g / 2,
                    left: e.left - f
                }, h = "left"), b.css(i).addClass(h).addClass("in").addClass(j)
            }
        },
        isHTML: function (a) {
            return typeof a != "string" || a.charAt(0) === "<" && a.charAt(a.length - 1) === ">" && a.length >= 3 || /^(?:[^<]*<[\w\W]+>[^>]*$)/.exec(a)
        },
        setContent: function () {
            var a = this.tip(),
                b = this.getTitle();
            a.find(".tip-inner")[this.isHTML(b) ? "html" : "text"](b), a.removeClass("fade in top bottom left right")
        },
        hide: function () {
            function d() {
                var b = setTimeout(function () {
                    c.off(a.support.transition.end).remove()
                }, 500);
                c.one(a.support.transition.end, function () {
                    clearTimeout(b), c.remove()
                })
            }
            var b = this,
                c = this.tip();
            return c.removeClass("in"), a.support.transition && this.$tip.hasClass("fade") ? d() : c.remove(), this
        },
        fixTitle: function () {
            var a = this.$element;
            (a.attr("title") || typeof a.attr("data-original-title") != "string") && a.attr("data-original-title", a.attr("title") || "").removeAttr("title")
        },
        hasContent: function () {
            return this.getTitle()
        },
        getPosition: function (b) {
            return a.extend({}, b ? {
                top: 0,
                left: 0
            } : this.$element.offset(), {
                width: this.$element[0].offsetWidth,
                height: this.$element[0].offsetHeight
            })
        },
        getTitle: function () {
            var a, b = this.$element,
                c = this.options;
            return a = b.attr("data-original-title") || (typeof c.title == "function" ? c.title.call(b[0]) : c.title), a
        },
        getTipName: function () {
            return this.$element.attr("data-tip-name")
        },
        tip: function () {
            return this.$tip = this.$tip || a(this.options.template)
        },
        validate: function () {
            this.$element[0].parentNode || (this.hide(), this.$element = null, this.options = null)
        },
        enable: function () {
            this.enabled = !0
        },
        disable: function () {
            this.enabled = !1
        },
        toggleEnabled: function () {
            this.enabled = !this.enabled
        },
        toggle: function () {
            this[this.tip().hasClass("in") ? "hide" : "show"]()
        },
        destroy: function () {
            this.hide().$element.off("." + this.type).removeData(this.type)
        },
        addOKCustomClass: function () {
            this.tip().removeClass("warning error info").addClass("ok")
        },
        addWarningInfoClass: function () {
            this.tip().removeClass("ok error info").addClass("warning")
        },
        addErrorCustomClass: function () {
            this.tip().removeClass("ok warning info").addClass("error")
        },
        addInfoCustomClass: function () {
            this.tip().removeClass("ok warning error").addClass("info")
        }
    }, a.fn.tip = function (c) {
        return this.each(function () {
            var d = a(this),
                e = d.data("tip"),
                f = typeof c == "object" && c;
            e || d.data("tip", e = new b(this, f)), typeof c == "string" && e[c]()
        })
    }, a.fn.tip.Constructor = b, a.fn.tip.defaults = {
        animation: !0,
        placement: "top",
        selector: !1,
        template: '<div class="tip"><div class="tip-arrow"></div><div class="tip-inner"></div></div>',
        trigger: "hover",
        title: "",
        delay: 0,
        classes: ""
    }
}(window.jQuery);
(function () {
    Myspace.Parallax = function (a, b) {
        function c() {
            b[0].style.left = -(a[0].scrollLeft / 2) + "px"
        }
        a.length && b.length && a.on("scroll", c)
    }
})();
var Myspace = Myspace || {};
(function (a) {
    function b(a, b) {
        if (window.innerHeight - b.bottom >= a) return "bottom";
        if (b.top >= a) return "top"
    }
    function c(a, b) {
        if (window.innerWidth - b.left >= a) return "right";
        if (b.right >= a) return "left"
    }
    function d(a, b, c) {
        return a === "bottom" ? c.bottom + 6 : c.top - b - 6
    }
    function e(a, b, c) {
        return a === "right" ? c.left : c.right - b
    }
    function f(a, b) {
        return b.clientX >= a.left && b.clientX <= a.right && b.clientY >= a.top && b.clientY <= a.bottom
    }
    Myspace.Popover = function (b, c) {
        this.$popover = b, this.options = a.extend({
            autoHide: !0,
            preRender: function (a, b, c) {
                c()
            },
            toggleClass: "popoverActive"
        }, c)
    }, Myspace.Popover.prototype.hide = function () {
        this.$popover.removeClass("open"), clearTimeout(this.mouseTimer), a(window).unbind("mousemove.popover"), this.options.onHide && this.options.onHide(this.$popover, this.$activeTarget), this.$activeTarget && this.$activeTarget.removeClass(this.options.toggleClass), delete this.$activeTarget
    }, Myspace.Popover.prototype.show = function (g, h) {
        if (this.$activeTarget) {
            if (this.$activeTarget[0] === g[0]) return;
            this.hide()
        }
        this.$activeTarget = g.addClass(this.options.toggleClass);
        var i = this;
        h && (this.options = a.extend(h, this.options)), this.options.preRender(this.$popover, g, function () {
            var h = g[0],
                j = h.getBoundingClientRect(),
                k = i.options.y || b(i.$popover.height(), j),
                l = i.options.x || c(i.$popover.width(), j),
                m = d(k, i.$popover.height(), j),
                n = e(l, i.$popover.width(), j);
            i.$popover.css({
                position: "fixed",
                top: m,
                left: n
            }).removeClass("top right bottom left").addClass("open " + k + " " + l), i.options.autoHide && (a(h).bind("mousewheel", function () {
                a(this).unbind("mousewheel"), i.hide()
            }), a(window).bind("mousemove.popover", function (a) {
                i.mouseTimer && clearTimeout(i.mouseTimer), i.mouseTimer = setTimeout(function () {
                    !f(i.$popover[0].getBoundingClientRect(), a) && !f(j, a) && i.hide()
                }, 100)
            }).unbind("blur.popover").bind("blur.popover", function () {
                i.hide()
            }))
        })
    };
    var g = {}, h = '<aside class="popover generic"><header></header><section></section></aside>';
    a.fn.popover = function (b) {
        b = a.extend({
            intentDelay: 400
        }, b);
        var c, d, e;
        return b.id ? (g[b.id] || (g[b.id] = a(h).attr("id", b.id).appendTo("body")), d = g[b.id]) : d = a(h).appendTo("body"), e = new Myspace.Popover(d, b), this.each(function () {
            var f = a(this);
            if (f.data("popover-initialized")) return;
            f.data("popover-initialized", !0), f.bind("mouseenter.popover", function () {
                if (e.activeTarget === this) return;
                c = setTimeout(function () {
                    b.title && d.find("header").html(b.title), b.content && d.find("section").html(b.content), e.show(f)
                }, b.intentDelay)
            }).bind("mouseleave.popover", function () {
                c && clearTimeout(c)
            })
        })
    }
})(jQuery);
var Myspace = Myspace || {};
(function (a) {
    function i(a) {
        Myspace.Confirm({
            closeAll: !1,
            text: a,
            yes: {
                text: "OK"
            },
            no: !1
        })
    }
    function j(a) {
        var b = a.title ? a.title : "this user";
        Myspace.Confirm({
            closeAll: !1,
            text: "Are you sure you want to block " + b + "? They will not be able to connect with you and your content.",
            yes: {
                text: "Confirm",
                onClick: function () {
                    comm.send("block", a)
                }
            },
            no: {
                text: "Cancel"
            }
        })
    }
    function k(a, b, c) {
        var d = "connect.status",
            e = {
                entityKey: a,
                isConnected: b,
                isPending: c
            };
        comm.send(d, e), scomm.send(d, e)
    }
    function l(a, b) {
        var c = b.entityKey,
            d = a === "connect";
        b.source && b.source.data("isConnected", d), b.isPending || k(c, d), b.onSuccess = function (e) {
            var f = e.outboundState === "Pending";
            if (!e.success) a == "connect" && f ? i("This connection requires approval. A connection request has been sent.") : a === "connect" && e.outboundState === "Blocked" ? i("Unfortunately, you cannot connect with this at this time.") : e.statusCode == 429 ? i("You have exceeded the permitted connect frequency.  Please try again later.") : setTimeout(function () {
                    Myspace.Error({
                        yes: {
                            onClick: function () {
                                k(c, d), comm.send(a, b)
                            }
                        }
                    })
                }, 550), k(c, !d, f);
            else {
                if (b.type === "mixtape") if (a === "disconnect") comm.send("mix.deleted", {
                            entityKey: c
                        });
                    else {
                        var g = b.id.split(",");
                        comm.send("mix.addConnected", {
                            playlistId: g[1],
                            profileId: g[0]
                        })
                    }
                b.isPending && !f && k(c, d)
            }
        }
    }
    function m(a, b) {
        var c = a.data("action"),
            e = a.data("requireLogin"),
            f = a.data("loginAction"),
            g = objectify(b);
        if (e && !Myspace.User.isLoggedIn) {
            comm.send("login.prompt", {
                action: f,
                object: g.entityKey
            });
            return
        }
        g.item = a, g.source = b;
        var h;
        a.is("li") ? h = new Tracking("HCard Menu", a.text(), g.type) : h = new Tracking("Connect Button", c, g.type), comm.send("track", h), comm.send("influencer.click", g.source), g.type === "profile" && (g.id = g.profileId || g.artistId), (c === "connect" || c === "disconnect") && l(c, g);
        if (c === "block") {
            j(g);
            return
        }
        if (["mix.selectAndAddItem", "song.delete", "video.delete"].indexOf(c) > -1) {
            var i, k;
            i = b.closest(".right").siblings(".left").find(".playBtn"), i.length || (i = b.closest(".mediaSquare,.media").find(".playBtn")), i.length && (k = objectify(i), g.mediaId = g.id, g.title = k.title, delete g.item, k.mediaReleaseId && (g.releaseId = k.mediaReleaseId));
            if (c === "song.delete" || c === "video.delete") g.profileId = context.playlistOwnerProfileId, g.playlistId = context.playlistId, g.objectVersion = context.objectVersion, g.sequenceId = k.sequenceId, g.mediaType = k.mediaType
        }
        c !== "connect" && c !== "disconnect" && c !== "connect>makeProfilePicture" && c !== "connect>makeProfileCover" && d.hide(), g.type === "video" && g.mediaReleaseId && (g.releaseEntityKey = "videorelease_" + g.mediaReleaseId), comm.send(c, g)
    }
    function n(b, c) {
        var d = "",
            e = b.find("ul"),
            i = c.data("type") || c.data("area").replace(/s+$/, "");
        g[i].menu.forEach(function (b) {
            var e = h[b](c);
            if (e) {
                var f = a("<li></li>").text(e.title).attr("data-action", e.action);
                e.requireLogin && f.attr("data-require-login", !0).attr("data-login-action", e.loginAction), d += f[0].outerHTML
            }
        }), e.html(d).unbind("click.hCard").bind("click.hCard", function (b) {
            var d = a(b.target);
            d.is("li") && m(d, c)
        });
        var j = e.find('[data-action="copy"]');
        if (j.length) {
            var k = c.parents(".media,.mediaSquare,.streamItem").find(".playBtn"),
                l = location.protocol + "//" + location.hostname;
            k.length || (k = a('.playBtn[data-uid="' + c.attr("data-uid") + '"]'));
            var n = l + (k.attr("data-type") == "video" ? k.attr("data-detail-url") : k.attr("data-url") + "?play=1");
            f.get(0).setText(n), j.mouseenter(function () {
                var a = j[0].getBoundingClientRect();
                j.addClass("hovered"), f.css(a), b.bind("mousemove.clipboard", function (c) {
                    c.clientX >= a.left && c.clientX <= a.right && c.clientY >= a.top && c.clientY <= a.bottom || (j.removeClass("hovered"), f.css({
                        top: -1e3,
                        left: -1e3
                    }), b.unbind("mousemove.clipboard"))
                })
            })
        }
    }
    function o(a) {
        return a.data("entityKey") || a.data("area") + "_" + a.data("id")
    }
    function p(c, d, e) {
        var f = {
            id: c.data("id")
        }, g = c.data("area"),
            h = o(c);
        if (b[h]) return e(b[h]);
        f.entityKey = c.data("entityKey"), f.influencer = c.closest("[data-influencer]").data("influencer"), d || (f.getConnection = !0), g === "profiles" ? f.profileid = "profile_" + (c.data("profileId") !== "undefined") ? c.data("profileId") : c.data("artistId") : g === "music" ? f.type = c.data("type") : g === "mixes" ? (f.profileid = c.data("profileId"), f.id = c.data("id").split(",")[1]) : g === "stream" && (f.actiontype = c.data("actiontype"), f.type = c.data("type"), f.itemaction = c.data("item-action")), a.ajax({
            type: "post",
            url: "/ajax/" + g + "/tooltip",
            data: f,
            success: function (a) {
                return d && (a.isConnected = c.data("isConnected"), a.isReverseConnected = c.data("isReverseConnected"), a.isPending = c.data("isPending")), b[h] = a, e(b[h])
            }
        })
    }
    function q(b, c, d) {
        var e = !c.hasClass("moreActivity"),
            f = typeof c.data("isConnected") == "undefined" ? !1 : !0,
            h = c.data("type") || c.data("area").replace(/s+$/, "");
        if (e) {
            if (h === "profile" && c.data("profileid") === context.profileId) return;
            b.html('<div id="hCard"><ul></ul><section class="loading white"></section></div>').height(g[h].height), f && n(b, c), c.data("area") ? p(c, f, function (d) {
                c.data("isReverseConnected", d.isReverseConnected), c.data("isConnected", d.isConnected), c.data("isPending", d.isPending), c.data("isPrivate", d.isPrivate), c.data("isOnline", d.isOnline), n(b, c), b.find("section").removeClass("loading").html(d.content).find('a[rel="tooltip"]').tip(), b.find("a").click(function () {
                    comm.send("track", new Tracking("HCard Content", h, a(this).attr("href")))
                }), b.find(".summaryDetails").length && b.find(".affinitySummary.hasDetails > div").hover(function () {
                    a(this).find(".summaryDetails").show(), b.css("height", "auto")
                })
            }) : b.find("#hCard").addClass("noContent"), r(c), d()
        } else p(c, !0, function (a) {
                b.html(a), r(c), d()
            })
    }
    function r(b) {
        b.bind("mousewheel", function () {
            a(this).unbind("mousewheel"), d.hide()
        })
    }
    function s(a, c) {
        c && c.hasClass("moreActivity") && (b[o(c)] = a.html()), a.height("auto").html()
    }
    function t(b) {
        b.find(".tooltips[data-popover-initialized!='true']").each(function () {
            var b = a(this);
            if (b.attr("data-popover-initialized")) return;
            b.attr("data-popover-initialized", !0), b.bind("mouseenter.popover", function () {
                if (d.$activeTarget && d.$activeTarget[0] === this) return;
                c = setTimeout(function () {
                    e.hasClass("dragging") || d.show(b)
                }, 400)
            }).bind("mouseleave.popover", function () {
                c && clearTimeout(c)
            }), b.hasClass("connectButton") && b.bind("touchstart.popover", function (a) {
                a.preventDefault(), d.$activeTarget ? d.hide() : d.show(b)
            })
        })
    }
    function u(b) {
        b.find("[rel='tooltip']").each(function () {
            var b = a(this).data("position") || "top";
            a(this).tip({
                placement: b,
                delay: 250
            })
        })
    }
    var b = {}, c, d, e = a("body"),
        f, g = {
            album: {
                height: 250,
                menu: ["Connect", "Queue", "Share", "Add to Mix", "Send as Message"]
            },
            mixtape: {
                height: 300,
                menu: ["Connect", "Queue", "Delete", "Share", "Send as Message"]
            },
            photo: {
                menu: ["Connect", "Delete", "Share", "Comment", "Profile Photo", "Profile Cover", "Report"]
            },
            profile: {
                height: 320,
                menu: ["Connect", "Share", "Start Radio", "Message", "Block", "Report"]
            },
            song: {
                height: 280,
                menu: ["Connect", "Queue", "Delete", "Share", "Add to Mix", "Start Radio", "Profile Song", "Send as Message", "Copy Link", "Report"]
            },
            video: {
                height: 250,
                menu: ["Connect", "Queue", "Share", "Add to Mix", "Send as Message", "Copy Link", "Report"]
            },
            article: {
                menu: ["Connect", "Share"]
            }
        }, h = {
            "Add to Mix": function () {
                return {
                    action: "mix.selectAndAddItem",
                    title: "Add to Mix",
                    requireLogin: !0,
                    loginAction: "addToMix"
                }
            },
            Comment: function (a) {
                return {
                    action: "connect>" + a.data("type") + "Comment",
                    title: "Comment",
                    requireLogin: !0,
                    loginAction: "comment"
                }
            },
            Connect: function (a) {
                var b, c;
                return a.data("isOwner") ? !1 : (a.data("isPending") ? (b = "connect", c = "Pending") : (b = a.data("isConnected") ? "disconnect" : "connect", c = a.data("isConnected") ? "Disconnect" : "Connect"), {
                    action: b,
                    title: c,
                    requireLogin: !0,
                    loginAction: "connect"
                })
            },
            Block: function (a) {
                if (Myspace.User.isLoggedIn && !a.data("isOwner")) {
                    var b = objectify(a);
                    return {
                        action: b.isBlocked ? "unblock" : "block",
                        title: b.isBlocked ? "Unblock" : "Block"
                    }
                }
                return !1
            },
            "Copy Link": function () {
                return f ? {
                    action: "copy",
                    title: "Copy Link",
                    requireLogin: !1
                } : !1
            },
            Delete: function (a) {
                var b = a.data("type");
                return Myspace.User.isLoggedIn && (b !== "mixtape" && b !== "song" && a.data("isOwner") || a.data("isRemovable")) ? {
                    action: b + ".delete",
                    title: "Delete"
                } : !1
            },
            "Profile Cover": function (a) {
                return Myspace.User.isLoggedIn && a.data("isOwner") ? {
                    action: "connect>makeProfileCover",
                    title: "Cover Photo"
                } : !1
            },
            "Profile Photo": function (a) {
                return Myspace.User.isLoggedIn && a.data("isOwner") ? {
                    action: "connect>makeProfilePicture",
                    title: "Profile Photo"
                } : !1
            },
            "Profile Song": function () {
                return {
                    action: "updateProfileSong",
                    title: "Profile Song",
                    requireLogin: !0,
                    loginAction: "makeProfileSong"
                }
            },
            "Report Song": function () {
                return Myspace.User.isLoggedIn && context.reportSongEnabled ? {
                    action: "report>song",
                    title: "Report Song"
                } : !1
            },
            "Send as Message": function () {
                return context.features.isMessagingEnabled ? {
                    action: "messaging.popout",
                    title: "Send as Message",
                    requireLogin: !0,
                    loginAction: "sendAsMessage"
                } : !1
            },
            Message: function (a) {
                var b = a.data("isConnected"),
                    c = a.data("isReverseConnected"),
                    d = a.data("isOnline"),
                    e = b && c,
                    f = context.features.isMessagingEnabled && (e && d || !Myspace.User.isLoggedIn);
                return f ? {
                    action: "instantmessage.open",
                    title: "Send Message",
                    requireLogin: !0,
                    loginAction: "message"
                } : !1
            },
            Share: function (a) {
                return a.data("isPrivate") ? !1 : {
                    action: "share",
                    title: "Share",
                    requireLogin: !0,
                    loginAction: "share"
                }
            },
            "Start Radio": function (a) {
                return context.features.isRadioEnabled && a.data("radioStationEntityKey") ? {
                    action: "playRadio",
                    title: "Start Radio",
                    requireLogin: !0,
                    loginAction: "playRadio"
                } : !1
            },
            Queue: function (a) {
                return a.data("type") === "mixtape" && a.closest(".mediaSquare,.media").hasClass("noMedia") ? !1 : {
                    action: "connect>queue",
                    title: "Queue",
                    requireLogin: !1
                }
            },
            Report: function (a) {
                return Myspace.User.isLoggedIn && !a.data("isOwner") ? {
                    action: "reportAbuse",
                    title: "Report"
                } : !1
            }
        };
    scomm.add(function (a, b) {
        a == "connect.status" && comm.send(a, b)
    }), comm.listen("connect.status", function (c) {
        var d = b[c.entityKey];
        d && (d.isConnected = c.isConnected, d.isPending = !! c.isPending), b[c.entityKey] = d, a('.tooltips[data-entity-key="' + c.entityKey + '"]').toggleClass("connected", c.isConnected), a("#hCard > ul > li:first-child").text(c.isConnected ? "Disconnect" : c.isPending ? "Pending" : "Connect").data("action", c.isConnected ? "disconnect" : "connect")
    }, !0), comm.listen("connect.complete", function (b) {
        b.action == "block" ? (a('.tooltips[data-entity-key="' + b.entityKey + '"]').data("isBlocked", !0), a("#hCard > ul > li[data-action='block']").attr("data-action", "unblock").html("Unblock"), b.isConnected = !1, comm.send("connect.status", b), context.displayProfileId != context.profileId && comm.send("location.href", window.location.pathname)) : b.action == "unblock" && (a('.tooltips[data-entity-key="' + b.entityKey + '"]').data("isBlocked", !1), a("#hCard > ul > li[data-action='unblock']").attr("data-action", "block").html("Block"))
    }, !0), d = new Myspace.Popover(a("#popover"), {
        preRender: q,
        onHide: s
    }), e.delegate(".connectButton", "click", function () {
        var b = a(this);
        if (!b.data("isOwner")) {
            var c = b.hasClass("connected") ? "disconnect" : "connect";
            b.data("action", c).data("requireLogin", !0).data("loginAction", c), m(b, b)
        }
        return !1
    }), t(e), u(e), comm.listen("hcard.init", t, !0), comm.listen("hcard.hide,search.overlay", function () {
        d.hide()
    }, !0), comm.listen("page.changed", function (b) {
        t(b), t(a("#sidebar")), u(b)
    }, !0), comm.listen("spaceway.page.complete", function () {
        b = {}, d.hide()
    }, !0), comm.listen({
        clipboard: {
            ready: function (a) {
                f = a
            },
            complete: function () {
                d.hide()
            }
        }
    }, !0)
})(jQuery);
(function (a) {
    function j(a, b, c) {
        var f = i[b.data("name")];
        d.text(f.title), e.text(f.content), c()
    }
    function k(c) {
        c.find(".myspaceTip").each(function () {
            var c = a(this);
            if (c.data("popoverInitialized") || c.data("helpTipDisabled")) return;
            c.data("popoverInitialized", !0), c.bind("mouseenter.popover", function () {
                if (g.$activeTarget && g.$activeTarget[0] === this) return;
                h = setTimeout(function () {
                    var a = {};
                    c.data("tipVerticalPlacement") && (a.y = c.data("tipVerticalPlacement")), b.hasClass("dragging") || g.show(c, a)
                }, 700)
            }).bind("mouseleave.popover", function () {
                h && clearTimeout(h)
            })
        })
    }
    var b = a("body"),
        c = a("#myspaceTip"),
        d = c.find("section > h6"),
        e = c.find("section > p"),
        f = c.find("header > .close"),
        g, h, i = {
            discover: {
                title: "Discover",
                content: "Discover new people, music, mixes and videos â€“ get inspired. Thereâ€™s a ton of content to explore, enjoy and share."
            },
            home: {
                title: "Home",
                content: "Check out the latest updates from the people and content youâ€™re connected to. Itâ€™s the perfect place to comment, share and connect."
            },
            incognito: {
                title: "Play Privacy Mode",
                content: "Choose whether you want your song and video plays to be public or private."
            },
            library: {
                title: "Library",
                content: "Your library consists of the songs, albums, videos and photos that you've uploaded, added to a mix or connected to."
            },
            manage: {
                title: "Manage",
                content: "Manage your audio and video catalog. Upload an original song, album or video here."
            },
            mixes: {
                title: "Mixes",
                content: "Weâ€™re taking photo albums and playlists to the next level. Mixes are collections of songs that you can combine with photos and videos."
            },
            people: {
                title: "People",
                content: "Check out the people you have connected to and those that have connected to you."
            },
            pin: {
                title: "Pin the Player Open",
                content: "Click the Pin button to keep your music player open as you discover the rest of the site."
            },
            profile: {
                title: "Your Profile",
                content: "Weâ€™ve created a place where you can customize your profile and cover images to express your creativity."
            },
            search: {
                title: "Search",
                content: "Simply start typing anytime to Search for artists, music or just about anything else. Seriously, just start typing"
            },
            superPost: {
                title: "Post",
                content: "Post your status with a song or photo to share it with your fellow collaborators."
            }
        };
    f.click(function () {
        g.$activeTarget && (g.$activeTarget.unbind("mouseenter.popover"), g.hide())
    }), g = new Myspace.Popover(c, {
        preRender: j
    }), k(b), comm.listen("search.overlay,spaceway.page.complete", function () {
        g.hide()
    }, !0)
})(jQuery);
var Myspace = Myspace || {};
(function (a) {
    var b, c, d;
    comm.listen("reportAbuse", function (c) {
        c.userEntityKey = c.userEntityKey || c.ownerEntityKey, !c.userEntityKey && c.entityKey.startsWith("profile") && (c.userEntityKey = c.entityKey), a.ajax({
            url: "/ajax/reportAbuse/" + c.type,
            type: "POST",
            dataType: "json",
            data: {
                userEntityKey: c.userEntityKey
            }
        }).done(function (e) {
            e.html && (d && d.remove(), a("body").append(e.html), d = a("#reportAbuseDialog"), b = new Myspace.Dialog(d, {
                closeAll: !0
            }), a("input:radio", d).click(function () {
                a(".reportNotes", d).hide();
                var b = a("input:radio:checked", d).parent().next(".reportNotes");
                b.slideDown("200", function () {
                    b.focus()
                })
            }), a(".cancel", d).click(function () {
                return b.hide(), !1
            }), a("button.primary", d).click(function () {
                var b = a("input:radio:checked", d).val();
                if (!b) return Myspace.Error({
                        text: "Select why you are reporting this content.",
                        no: !1,
                        yes: {
                            text: "OK"
                        },
                        closeAll: !1
                    }), !0;
                var e = a('input[name="block"]', d).is(":checked"),
                    f = a("input:radio:checked", d).parent().next(".reportNotes").val();
                return a.ajax({
                    url: "/ajax/reportAbuse",
                    type: "POST",
                    dataType: "json",
                    data: {
                        entityKey: c.releaseEntityKey || c.entityKey,
                        reason: b,
                        note: f
                    }
                }).done(function (a) {
                    a.success && (a.duplicate ? Myspace.successDialog("You have already reported this content.") : Myspace.successDialog("Your report will be reviewed and an action will be taken based on our terms of use.", "Content successfully reported")), e && window.setTimeout(function () {
                        comm.send("block", {
                            entityKey: c.userEntityKey,
                            type: c.userEntityKey.substring(0, c.userEntityKey.indexOf("_")),
                            id: c.userEntityKey.substring(c.userEntityKey.indexOf("_") + 1)
                        })
                    }, 4e3)
                }), !1
            }), b.show(!1))
        })
    }, !0)
})(jQuery);
var Faye = typeof Faye == "object" ? Faye : {};
typeof window != "undefined" && (window.Faye = Faye), Faye.extend = function (a, b, c) {
    if (!b) return a;
    for (var d in b) {
        if (!b.hasOwnProperty(d)) continue;
        if (a.hasOwnProperty(d) && c === !1) continue;
        a[d] !== b[d] && (a[d] = b[d])
    }
    return a
}, Faye.extend(Faye, {
    VERSION: "0.8.8",
    BAYEUX_VERSION: "1.0",
    ID_LENGTH: 160,
    JSONP_CALLBACK: "jsonpcallback",
    CONNECTION_TYPES: ["long-polling", "cross-origin-long-polling", "callback-polling", "websocket", "eventsource", "in-process"],
    MANDATORY_CONNECTION_TYPES: ["long-polling", "callback-polling", "in-process"],
    ENV: function () {
        return this
    }(),
    random: function (a) {
        a = a || this.ID_LENGTH;
        if (a > 32) {
            var b = Math.ceil(a / 32),
                c = "";
            while (b--) c += this.random(32);
            var d = c.split(""),
                e = "";
            while (d.length > 0) e += d.pop();
            return e
        }
        var f = Math.pow(2, a) - 1,
            g = f.toString(36).length,
            c = Math.floor(Math.random() * f).toString(36);
        while (c.length < g) c = "0" + c;
        return c
    },
    clientIdFromMessages: function (a) {
        var b = [].concat(a)[0];
        return b && b.clientId
    },
    copyObject: function (a) {
        var b, c, d;
        if (a instanceof Array) {
            b = [], c = a.length;
            while (c--) b[c] = Faye.copyObject(a[c]);
            return b
        }
        if (typeof a == "object") {
            b = a === null ? null : {};
            for (d in a) b[d] = Faye.copyObject(a[d]);
            return b
        }
        return a
    },
    commonElement: function (a, b) {
        for (var c = 0, d = a.length; c < d; c++) if (this.indexOf(b, a[c]) !== -1) return a[c];
        return null
    },
    indexOf: function (a, b) {
        if (a.indexOf) return a.indexOf(b);
        for (var c = 0, d = a.length; c < d; c++) if (a[c] === b) return c;
        return -1
    },
    map: function (a, b, c) {
        if (a.map) return a.map(b, c);
        var d = [];
        if (a instanceof Array) for (var e = 0, f = a.length; e < f; e++) d.push(b.call(c || null, a[e], e));
        else for (var g in a) {
                if (!a.hasOwnProperty(g)) continue;
                d.push(b.call(c || null, g, a[g]))
        }
        return d
    },
    filter: function (a, b, c) {
        var d = [];
        for (var e = 0, f = a.length; e < f; e++) b.call(c || null, a[e], e) && d.push(a[e]);
        return d
    },
    asyncEach: function (a, b, c, d) {
        var e = a.length,
            f = -1,
            g = 0,
            h = !1,
            i = function () {
                g -= 1, f += 1;
                if (f === e) return c && c.call(d);
                b(a[f], k)
            }, j = function () {
                if (h) return;
                h = !0;
                while (g > 0) i();
                h = !1
            }, k = function () {
                g += 1, j()
            };
        k()
    },
    toJSON: function (a) {
        return this.stringify ? this.stringify(a, function (a, b) {
            return this[a] instanceof Array ? this[a] : b
        }) : JSON.stringify(a)
    },
    logger: function (a) {
        typeof console != "undefined" && console.log(a)
    },
    timestamp: function () {
        var a = new Date,
            b = a.getFullYear(),
            c = a.getMonth() + 1,
            d = a.getDate(),
            e = a.getHours(),
            f = a.getMinutes(),
            g = a.getSeconds(),
            h = function (a) {
                return a < 10 ? "0" + a : String(a)
            };
        return h(b) + "-" + h(c) + "-" + h(d) + " " + h(e) + ":" + h(f) + ":" + h(g)
    }
}), Faye.Class = function (a, b) {
    typeof a != "function" && (b = a, a = Object);
    var c = function () {
        return this.initialize ? this.initialize.apply(this, arguments) || this : this
    }, d = function () {};
    return d.prototype = a.prototype, c.prototype = new d, Faye.extend(c.prototype, b), c
}, Faye.Namespace = Faye.Class({
    initialize: function () {
        this._used = {}
    },
    exists: function (a) {
        return this._used.hasOwnProperty(a)
    },
    generate: function () {
        var a = Faye.random();
        while (this._used.hasOwnProperty(a)) a = Faye.random();
        return this._used[a] = a
    },
    release: function (a) {
        delete this._used[a]
    }
}), Faye.Error = Faye.Class({
    initialize: function (a, b, c) {
        this.code = a, this.params = Array.prototype.slice.call(b), this.message = c
    },
    toString: function () {
        return this.code + ":" + this.params.join(",") + ":" + this.message
    }
}), Faye.Error.parse = function (a) {
    a = a || "";
    if (!Faye.Grammar.ERROR.test(a)) return new this(null, [], a);
    var b = a.split(":"),
        c = parseInt(b[0]),
        d = b[1].split(","),
        a = b[2];
    return new this(c, d, a)
}, Faye.Error.versionMismatch = function () {
    return (new this(300, arguments, "Version mismatch")).toString()
}, Faye.Error.conntypeMismatch = function () {
    return (new this(301, arguments, "Connection types not supported")).toString()
}, Faye.Error.extMismatch = function () {
    return (new this(302, arguments, "Extension mismatch")).toString()
}, Faye.Error.badRequest = function () {
    return (new this(400, arguments, "Bad request")).toString()
}, Faye.Error.clientUnknown = function () {
    return (new this(401, arguments, "Unknown client")).toString()
}, Faye.Error.parameterMissing = function () {
    return (new this(402, arguments, "Missing required parameter")).toString()
}, Faye.Error.channelForbidden = function () {
    return (new this(403, arguments, "Forbidden channel")).toString()
}, Faye.Error.channelUnknown = function () {
    return (new this(404, arguments, "Unknown channel")).toString()
}, Faye.Error.channelInvalid = function () {
    return (new this(405, arguments, "Invalid channel")).toString()
}, Faye.Error.extUnknown = function () {
    return (new this(406, arguments, "Unknown extension")).toString()
}, Faye.Error.publishFailed = function () {
    return (new this(407, arguments, "Failed to publish")).toString()
}, Faye.Error.serverError = function () {
    return (new this(500, arguments, "Internal server error")).toString()
}, Faye.Deferrable = {
    callback: function (a, b) {
        if (!a) return;
        if (this._deferredStatus === "succeeded") return a.apply(b, this._deferredArgs);
        this._callbacks = this._callbacks || [], this._callbacks.push([a, b])
    },
    timeout: function (a, b) {
        var c = this,
            d = Faye.ENV.setTimeout(function () {
                c.setDeferredStatus("failed", b)
            }, a * 1e3);
        this._timer = d
    },
    errback: function (a, b) {
        if (!a) return;
        if (this._deferredStatus === "failed") return a.apply(b, this._deferredArgs);
        this._errbacks = this._errbacks || [], this._errbacks.push([a, b])
    },
    setDeferredStatus: function () {
        this._timer && Faye.ENV.clearTimeout(this._timer);
        var a = Array.prototype.slice.call(arguments),
            b = a.shift(),
            c;
        this._deferredStatus = b, this._deferredArgs = a, b === "succeeded" ? c = this._callbacks : b === "failed" && (c = this._errbacks);
        if (!c) return;
        var d;
        while (d = c.shift()) d[0].apply(d[1], this._deferredArgs)
    }
}, Faye.Publisher = {
    countListeners: function (a) {
        return !this._subscribers || !this._subscribers[a] ? 0 : this._subscribers[a].length
    },
    bind: function (a, b, c) {
        this._subscribers = this._subscribers || {};
        var d = this._subscribers[a] = this._subscribers[a] || [];
        d.push([b, c])
    },
    unbind: function (a, b, c) {
        if (!this._subscribers || !this._subscribers[a]) return;
        if (!b) {
            delete this._subscribers[a];
            return
        }
        var d = this._subscribers[a],
            e = d.length;
        while (e--) {
            if (b !== d[e][0]) continue;
            if (c && d[e][1] !== c) continue;
            d.splice(e, 1)
        }
    },
    trigger: function () {
        var a = Array.prototype.slice.call(arguments),
            b = a.shift();
        if (!this._subscribers || !this._subscribers[b]) return;
        var c = this._subscribers[b].slice(),
            d;
        for (var e = 0, f = c.length; e < f; e++) d = c[e], d[0].apply(d[1], a)
    }
}, Faye.Timeouts = {
    addTimeout: function (a, b, c, d) {
        this._timeouts = this._timeouts || {};
        if (this._timeouts.hasOwnProperty(a)) return;
        var e = this;
        this._timeouts[a] = Faye.ENV.setTimeout(function () {
            delete e._timeouts[a], c.call(d)
        }, 1e3 * b)
    },
    removeTimeout: function (a) {
        this._timeouts = this._timeouts || {};
        var b = this._timeouts[a];
        if (!b) return;
        clearTimeout(b), delete this._timeouts[a]
    }
}, Faye.Logging = {
    LOG_LEVELS: {
        error: 3,
        warn: 2,
        info: 1,
        debug: 0
    },
    logLevel: "error",
    log: function (a, b) {
        if (!Faye.logger) return;
        var c = Faye.Logging.LOG_LEVELS;
        if (c[Faye.Logging.logLevel] > c[b]) return;
        var a = Array.prototype.slice.apply(a),
            d = " [" + b.toUpperCase() + "] [Faye",
            e = this.className,
            f = a.shift().replace(/\?/g, function () {
                try {
                    return Faye.toJSON(a.shift())
                } catch (b) {
                    return "[Object]"
                }
            });
        for (var g in Faye) {
            if (e) continue;
            if (typeof Faye[g] != "function") continue;
            this instanceof Faye[g] && (e = g)
        }
        e && (d += "." + e), d += "] ", Faye.logger(Faye.timestamp() + d + f)
    }
},
function () {
    for (var a in Faye.Logging.LOG_LEVELS)(function (a, b) {
            Faye.Logging[a] = function () {
                this.log(arguments, a)
            }
        })(a, Faye.Logging.LOG_LEVELS[a])
}(), Faye.Grammar = {
    LOWALPHA: /^[a-z]$/,
    UPALPHA: /^[A-Z]$/,
    ALPHA: /^([a-z]|[A-Z])$/,
    DIGIT: /^[0-9]$/,
    ALPHANUM: /^(([a-z]|[A-Z])|[0-9])$/,
    MARK: /^(\-|\_|\!|\~|\(|\)|\$|\@)$/,
    STRING: /^(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*$/,
    TOKEN: /^(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+$/,
    INTEGER: /^([0-9])+$/,
    CHANNEL_SEGMENT: /^(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+$/,
    CHANNEL_SEGMENTS: /^(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+(\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+)*$/,
    CHANNEL_NAME: /^\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+(\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+)*$/,
    WILD_CARD: /^\*{1,2}$/,
    CHANNEL_PATTERN: /^(\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+)*\/\*{1,2}$/,
    VERSION_ELEMENT: /^(([a-z]|[A-Z])|[0-9])(((([a-z]|[A-Z])|[0-9])|\-|\_))*$/,
    VERSION: /^([0-9])+(\.(([a-z]|[A-Z])|[0-9])(((([a-z]|[A-Z])|[0-9])|\-|\_))*)*$/,
    CLIENT_ID: /^((([a-z]|[A-Z])|[0-9]))+$/,
    ID: /^((([a-z]|[A-Z])|[0-9]))+$/,
    ERROR_MESSAGE: /^(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*$/,
    ERROR_ARGS: /^(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*(,(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*)*$/,
    ERROR_CODE: /^[0-9][0-9][0-9]$/,
    ERROR: /^([0-9][0-9][0-9]:(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*(,(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*)*:(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*|[0-9][0-9][0-9]::(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*)$/
}, Faye.Extensible = {
    addExtension: function (a) {
        this._extensions = this._extensions || [], this._extensions.push(a), a.added && a.added(this)
    },
    removeExtension: function (a) {
        if (!this._extensions) return;
        var b = this._extensions.length;
        while (b--) {
            if (this._extensions[b] !== a) continue;
            this._extensions.splice(b, 1), a.removed && a.removed(this)
        }
    },
    pipeThroughExtensions: function (a, b, c, d) {
        this.debug("Passing through ? extensions: ?", a, b);
        if (!this._extensions) return c.call(d, b);
        var e = this._extensions.slice(),
            f = function (b) {
                if (!b) return c.call(d, b);
                var g = e.shift();
                if (!g) return c.call(d, b);
                g[a] ? g[a](b, f) : f(b)
            };
        f(b)
    }
}, Faye.extend(Faye.Extensible, Faye.Logging), Faye.Channel = Faye.Class({
    initialize: function (a) {
        this.id = this.name = a
    },
    push: function (a) {
        this.trigger("message", a)
    },
    isUnused: function () {
        return this.countListeners("message") === 0
    }
}), Faye.extend(Faye.Channel.prototype, Faye.Publisher), Faye.extend(Faye.Channel, {
    HANDSHAKE: "/meta/handshake",
    CONNECT: "/meta/connect",
    SUBSCRIBE: "/meta/subscribe",
    UNSUBSCRIBE: "/meta/unsubscribe",
    DISCONNECT: "/meta/disconnect",
    META: "meta",
    SERVICE: "service",
    expand: function (a) {
        var b = this.parse(a),
            c = ["/**", a],
            d = b.slice();
        d[d.length - 1] = "*", c.push(this.unparse(d));
        for (var e = 1, f = b.length; e < f; e++) d = b.slice(0, e), d.push("**"), c.push(this.unparse(d));
        return c
    },
    isValid: function (a) {
        return Faye.Grammar.CHANNEL_NAME.test(a) || Faye.Grammar.CHANNEL_PATTERN.test(a)
    },
    parse: function (a) {
        return this.isValid(a) ? a.split("/").slice(1) : null
    },
    unparse: function (a) {
        return "/" + a.join("/")
    },
    isMeta: function (a) {
        var b = this.parse(a);
        return b ? b[0] === this.META : null
    },
    isService: function (a) {
        var b = this.parse(a);
        return b ? b[0] === this.SERVICE : null
    },
    isSubscribable: function (a) {
        return this.isValid(a) ? !this.isMeta(a) && !this.isService(a) : null
    },
    Set: Faye.Class({
        initialize: function () {
            this._channels = {}
        },
        getKeys: function () {
            var a = [];
            for (var b in this._channels) a.push(b);
            return a
        },
        remove: function (a) {
            delete this._channels[a]
        },
        hasSubscription: function (a) {
            return this._channels.hasOwnProperty(a)
        },
        subscribe: function (a, b, c) {
            if (!b) return;
            var d;
            for (var e = 0, f = a.length; e < f; e++) {
                d = a[e];
                var g = this._channels[d] = this._channels[d] || new Faye.Channel(d);
                g.bind("message", b, c)
            }
        },
        unsubscribe: function (a, b, c) {
            var d = this._channels[a];
            return d ? (d.unbind("message", b, c), d.isUnused() ? (this.remove(a), !0) : !1) : !1
        },
        distributeMessage: function (a) {
            var b = Faye.Channel.expand(a.channel);
            for (var c = 0, d = b.length; c < d; c++) {
                var e = this._channels[b[c]];
                e && e.trigger("message", a.data)
            }
        }
    })
}), Faye.Publication = Faye.Class(Faye.Deferrable), Faye.Subscription = Faye.Class({
    initialize: function (a, b, c, d) {
        this._client = a, this._channels = b, this._callback = c, this._context = d, this._cancelled = !1
    },
    cancel: function () {
        if (this._cancelled) return;
        this._client.unsubscribe(this._channels, this._callback, this._context), this._cancelled = !0
    },
    unsubscribe: function () {
        this.cancel()
    }
}), Faye.extend(Faye.Subscription.prototype, Faye.Deferrable), Faye.Client = Faye.Class({
    UNCONNECTED: 1,
    CONNECTING: 2,
    CONNECTED: 3,
    DISCONNECTED: 4,
    HANDSHAKE: "handshake",
    RETRY: "retry",
    NONE: "none",
    CONNECTION_TIMEOUT: 60,
    DEFAULT_RETRY: 5,
    DEFAULT_ENDPOINT: "/bayeux",
    INTERVAL: 0,
    initialize: function (a, b) {
        this.info("New client created for ?", a), this._options = b || {}, this.endpoint = a || this.DEFAULT_ENDPOINT, this.endpoints = this._options.endpoints || {}, this.transports = {}, this._cookies = Faye.CookieJar && new Faye.CookieJar, this._headers = {}, this._disabled = [], this.retry = this._options.retry || this.DEFAULT_RETRY, this._selectTransport(Faye.MANDATORY_CONNECTION_TYPES), this._state = this.UNCONNECTED, this._channels = new Faye.Channel.Set, this._messageId = 0, this._responseCallbacks = {}, this._advice = {
            reconnect: this.RETRY,
            interval: 1e3 * (this._options.interval || this.INTERVAL),
            timeout: 1e3 * (this._options.timeout || this.CONNECTION_TIMEOUT)
        }, Faye.Event && Faye.Event.on(Faye.ENV, "beforeunload", function () {
            Faye.indexOf(this._disabled, "autodisconnect") < 0 && this.disconnect()
        }, this)
    },
    disable: function (a) {
        this._disabled.push(a)
    },
    setHeader: function (a, b) {
        this._headers[a] = b
    },
    getClientId: function () {
        return this._clientId
    },
    getState: function () {
        switch (this._state) {
            case this.UNCONNECTED:
                return "UNCONNECTED";
            case this.CONNECTING:
                return "CONNECTING";
            case this.CONNECTED:
                return "CONNECTED";
            case this.DISCONNECTED:
                return "DISCONNECTED"
        }
    },
    handshake: function (a, b) {
        if (this._advice.reconnect === this.NONE) return;
        if (this._state !== this.UNCONNECTED) return;
        this._state = this.CONNECTING;
        var c = this;
        this.info("Initiating handshake with ?", this.endpoint), this._send({
            channel: Faye.Channel.HANDSHAKE,
            version: Faye.BAYEUX_VERSION,
            supportedConnectionTypes: [this._transport.connectionType]
        }, function (d) {
            if (d.successful) {
                this._state = this.CONNECTED, this._clientId = d.clientId;
                var e = Faye.filter(d.supportedConnectionTypes, function (a) {
                    return Faye.indexOf(this._disabled, a) < 0
                }, this);
                this._selectTransport(e), this.info("Handshake successful: ?", this._clientId), this.subscribe(this._channels.getKeys(), !0), a && a.call(b)
            } else this.info("Handshake unsuccessful"), Faye.ENV.setTimeout(function () {
                    c.handshake(a, b)
                }, this._advice.interval), this._state = this.UNCONNECTED
        }, this)
    },
    connect: function (a, b) {
        if (this._advice.reconnect === this.NONE) return;
        if (this._state === this.DISCONNECTED) return;
        if (this._state === this.UNCONNECTED) return this.handshake(function () {
                this.connect(a, b)
            }, this);
        this.callback(a, b);
        if (this._state !== this.CONNECTED) return;
        this.info("Calling deferred actions for ?", this._clientId), this.setDeferredStatus("succeeded"), this.setDeferredStatus("deferred");
        if (this._connectRequest) return;
        this._connectRequest = !0, this.info("Initiating connection for ?", this._clientId), this._send({
            channel: Faye.Channel.CONNECT,
            clientId: this._clientId,
            connectionType: this._transport.connectionType
        }, this._cycleConnection, this)
    },
    disconnect: function () {
        if (this._state !== this.CONNECTED) return;
        this._state = this.DISCONNECTED, this.info("Disconnecting ?", this._clientId), this._send({
            channel: Faye.Channel.DISCONNECT,
            clientId: this._clientId
        }, function (a) {
            a.successful && this._transport.close()
        }, this), this.info("Clearing channel listeners for ?", this._clientId), this._channels = new Faye.Channel.Set
    },
    subscribe: function (a, b, c) {
        if (a instanceof Array) return Faye.map(a, function (a) {
                return this.subscribe(a, b, c)
            }, this);
        var d = new Faye.Subscription(this, a, b, c),
            e = b === !0,
            f = this._channels.hasSubscription(a);
        return f && !e ? (this._channels.subscribe([a], b, c), d.setDeferredStatus("succeeded"), d) : (this.connect(function () {
            this.info("Client ? attempting to subscribe to ?", this._clientId, a), e || this._channels.subscribe([a], b, c), this._send({
                channel: Faye.Channel.SUBSCRIBE,
                clientId: this._clientId,
                subscription: a
            }, function (e) {
                if (!e.successful) return d.setDeferredStatus("failed", Faye.Error.parse(e.error)), this._channels.unsubscribe(a, b, c);
                var f = [].concat(e.subscription);
                this.info("Subscription acknowledged for ? to ?", this._clientId, f), d.setDeferredStatus("succeeded")
            }, this)
        }, this), d)
    },
    unsubscribe: function (a, b, c) {
        if (a instanceof Array) return Faye.map(a, function (a) {
                return this.unsubscribe(a, b, c)
            }, this);
        var d = this._channels.unsubscribe(a, b, c);
        if (!d) return;
        this.connect(function () {
            this.info("Client ? attempting to unsubscribe from ?", this._clientId, a), this._send({
                channel: Faye.Channel.UNSUBSCRIBE,
                clientId: this._clientId,
                subscription: a
            }, function (a) {
                if (!a.successful) return;
                var b = [].concat(a.subscription);
                this.info("Unsubscription acknowledged for ? from ?", this._clientId, b)
            }, this)
        }, this)
    },
    publish: function (a, b) {
        var c = new Faye.Publication;
        return this.connect(function () {
            this.info("Client ? queueing published message to ?: ?", this._clientId, a, b), this._send({
                channel: a,
                data: b,
                clientId: this._clientId
            }, function (a) {
                a.successful ? c.setDeferredStatus("succeeded") : c.setDeferredStatus("failed", Faye.Error.parse(a.error))
            }, this)
        }, this), c
    },
    receiveMessage: function (a) {
        this.pipeThroughExtensions("incoming", a, function (a) {
            if (!a) return;
            a.advice && this._handleAdvice(a.advice), this._deliverMessage(a);
            if (a.successful === undefined) return;
            var b = this._responseCallbacks[a.id];
            if (!b) return;
            delete this._responseCallbacks[a.id], b[0].call(b[1], a)
        }, this)
    },
    _selectTransport: function (a) {
        Faye.Transport.get(this, a, function (a) {
            this.debug("Selected ? transport for ?", a.connectionType, a.endpoint), this._transport = a, this._transport.cookies = this._cookies, this._transport.headers = this._headers, a.bind("down", function () {
                if (this._transportUp !== undefined && !this._transportUp) return;
                this._transportUp = !1, this.trigger("transport:down")
            }, this), a.bind("up", function () {
                if (this._transportUp !== undefined && this._transportUp) return;
                this._transportUp = !0, this.trigger("transport:up")
            }, this)
        }, this)
    },
    _send: function (a, b, c) {
        a.id = this._generateMessageId(), b && (this._responseCallbacks[a.id] = [b, c]), this.pipeThroughExtensions("outgoing", a, function (a) {
            if (!a) return;
            this._transport.send(a, this._advice.timeout / 1e3)
        }, this)
    },
    _generateMessageId: function () {
        return this._messageId += 1, this._messageId >= Math.pow(2, 32) && (this._messageId = 0), this._messageId.toString(36)
    },
    _handleAdvice: function (a) {
        Faye.extend(this._advice, a), this._advice.reconnect === this.HANDSHAKE && this._state !== this.DISCONNECTED && (this._state = this.UNCONNECTED, this._clientId = null, this._cycleConnection())
    },
    _deliverMessage: function (a) {
        if (!a.channel || a.data === undefined) return;
        this.info("Client ? calling listeners for ? with ?", this._clientId, a.channel, a.data), this._channels.distributeMessage(a)
    },
    _teardownConnection: function () {
        if (!this._connectRequest) return;
        this._connectRequest = null, this.info("Closed connection for ?", this._clientId)
    },
    _cycleConnection: function () {
        this._teardownConnection();
        var a = this;
        Faye.ENV.setTimeout(function () {
            a.connect()
        }, this._advice.interval)
    }
}), Faye.extend(Faye.Client.prototype, Faye.Deferrable), Faye.extend(Faye.Client.prototype, Faye.Publisher), Faye.extend(Faye.Client.prototype, Faye.Logging), Faye.extend(Faye.Client.prototype, Faye.Extensible), Faye.Transport = Faye.extend(Faye.Class({
    MAX_DELAY: 0,
    batching: !0,
    initialize: function (a, b) {
        this._client = a, this.endpoint = b, this._outbox = []
    },
    close: function () {},
    send: function (a, b) {
        this.debug("Client ? sending message to ?: ?", this._client._clientId, this.endpoint, a);
        if (!this.batching) return this.request([a], b);
        this._outbox.push(a), this._timeout = b;
        if (a.channel === Faye.Channel.HANDSHAKE) return this.addTimeout("publish", .01, this.flush, this);
        a.channel === Faye.Channel.CONNECT && (this._connectMessage = a);
        if (this.shouldFlush && this.shouldFlush(this._outbox)) return this.flush();
        this.addTimeout("publish", this.MAX_DELAY, this.flush, this)
    },
    flush: function () {
        this.removeTimeout("publish"), this._outbox.length > 1 && this._connectMessage && (this._connectMessage.advice = {
            timeout: 0
        }), this.request(this._outbox, this._timeout), this._connectMessage = null, this._outbox = []
    },
    receive: function (a) {
        this.debug("Client ? received from ?: ?", this._client._clientId, this.endpoint, a);
        for (var b = 0, c = a.length; b < c; b++) this._client.receiveMessage(a[b])
    },
    retry: function (a, b) {
        var c = !1,
            d = this._client.retry * 1e3,
            e = this;
        return function () {
            if (c) return;
            c = !0, Faye.ENV.setTimeout(function () {
                e.request(a, b)
            }, d)
        }
    }
}), {
    MAX_URL_LENGTH: 2048,
    get: function (a, b, c, d) {
        var e = a.endpoint;
        b === undefined && (b = this.supportedConnectionTypes()), Faye.asyncEach(this._transports, function (f, g) {
            var h = f[0],
                i = f[1],
                j = a.endpoints[h] || e;
            if (Faye.indexOf(b, h) < 0) return i.isUsable(a, j, function () {}), g();
            i.isUsable(a, j, function (b) {
                if (!b) return g();
                var e = i.hasOwnProperty("create") ? i.create(a, j) : new i(a, j);
                c.call(d, e)
            })
        }, function () {
            throw new Error("Could not find a usable connection type for " + e)
        })
    },
    register: function (a, b) {
        this._transports.push([a, b]), b.prototype.connectionType = a
    },
    _transports: [],
    supportedConnectionTypes: function () {
        return Faye.map(this._transports, function (a) {
            return a[0]
        })
    }
}), Faye.extend(Faye.Transport.prototype, Faye.Logging), Faye.extend(Faye.Transport.prototype, Faye.Publisher), Faye.extend(Faye.Transport.prototype, Faye.Timeouts), Faye.Event = {
    _registry: [],
    on: function (a, b, c, d) {
        var e = function () {
            c.call(d)
        };
        a.addEventListener ? a.addEventListener(b, e, !1) : a.attachEvent("on" + b, e), this._registry.push({
            _element: a,
            _type: b,
            _callback: c,
            _context: d,
            _handler: e
        })
    },
    detach: function (a, b, c, d) {
        var e = this._registry.length,
            f;
        while (e--) {
            f = this._registry[e];
            if (a && a !== f._element || b && b !== f._type || c && c !== f._callback || d && d !== f._context) continue;
            f._element.removeEventListener ? f._element.removeEventListener(f._type, f._handler, !1) : f._element.detachEvent("on" + f._type, f._handler), this._registry.splice(e, 1), f = null
        }
    }
}, Faye.Event.on(Faye.ENV, "unload", Faye.Event.detach, Faye.Event), Faye.URI = Faye.extend(Faye.Class({
    queryString: function () {
        var a = [];
        for (var b in this.params) {
            if (!this.params.hasOwnProperty(b)) continue;
            a.push(encodeURIComponent(b) + "=" + encodeURIComponent(this.params[b]))
        }
        return a.join("&")
    },
    isSameOrigin: function () {
        var a = Faye.URI.parse(Faye.ENV.location.href),
            b = a.hostname !== this.hostname || a.port !== this.port || a.protocol !== this.protocol;
        return !b
    },
    toURL: function () {
        var a = this.queryString();
        return this.protocol + "//" + this.hostname + (this.port ? ":" + this.port : "") + this.pathname + (a ? "?" + a : "") + this.hash
    }
}), {
    parse: function (a, b) {
        if (typeof a != "string") return a;
        var c = new this,
            d, e = function (b, d, e) {
                a = a.replace(d, function (a) {
                    return c[b] = a, ""
                }), c[b] === undefined && (c[b] = e ? Faye.ENV.location[b] : "")
            };
        e("protocol", /^https?\:/, !0), e("host", /^\/\/[^\/]+/, !0), /^\//.test(a) || (a = Faye.ENV.location.pathname.replace(/[^\/]*$/, "") + a), e("pathname", /^\/[^\?#]*/), e("search", /^\?[^#]*/), e("hash", /^#.*/), /^\/\//.test(c.host) ? (c.host = c.host.substr(2), d = c.host.split(":"), c.hostname = d[0], c.port = d[1] || "") : (c.hostname = Faye.ENV.location.hostname, c.port = Faye.ENV.location.port);
        var f = c.search.replace(/^\?/, ""),
            g = f ? f.split("&") : [],
            h = g.length,
            i = {};
        while (h--) d = g[h].split("="), i[decodeURIComponent(d[0] || "")] = decodeURIComponent(d[1] || "");
        return typeof b == "object" && Faye.extend(i, b), c.params = i, c
    }
}), this.JSON || (JSON = {}),
function () {
    function f(a) {
        return a < 10 ? "0" + a : a
    }
    function quote(a) {
        return escapable.lastIndex = 0, escapable.test(a) ? '"' + a.replace(escapable, function (a) {
            var b = meta[a];
            return typeof b == "string" ? b : "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4)
        }) + '"' : '"' + a + '"'
    }
    function str(a, b) {
        var c, d, e, f, g = gap,
            h, i = b[a];
        i && typeof i == "object" && typeof i.toJSON == "function" && (i = i.toJSON(a)), typeof rep == "function" && (i = rep.call(b, a, i));
        switch (typeof i) {
            case "string":
                return quote(i);
            case "number":
                return isFinite(i) ? String(i) : "null";
            case "boolean":
            case "null":
                return String(i);
            case "object":
                if (!i) return "null";
                gap += indent, h = [];
                if (Object.prototype.toString.apply(i) === "[object Array]") {
                    f = i.length;
                    for (c = 0; c < f; c += 1) h[c] = str(c, i) || "null";
                    return e = h.length === 0 ? "[]" : gap ? "[\n" + gap + h.join(",\n" + gap) + "\n" + g + "]" : "[" + h.join(",") + "]", gap = g, e
                }
                if (rep && typeof rep == "object") {
                    f = rep.length;
                    for (c = 0; c < f; c += 1) d = rep[c], typeof d == "string" && (e = str(d, i), e && h.push(quote(d) + (gap ? ": " : ":") + e))
                } else for (d in i) Object.hasOwnProperty.call(i, d) && (e = str(d, i), e && h.push(quote(d) + (gap ? ": " : ":") + e));
                return e = h.length === 0 ? "{}" : gap ? "{\n" + gap + h.join(",\n" + gap) + "\n" + g + "}" : "{" + h.join(",") + "}", gap = g, e
        }
    }
    typeof Date.prototype.toJSON != "function" && (Date.prototype.toJSON = function (a) {
        return this.getUTCFullYear() + "-" + f(this.getUTCMonth() + 1) + "-" + f(this.getUTCDate()) + "T" + f(this.getUTCHours()) + ":" + f(this.getUTCMinutes()) + ":" + f(this.getUTCSeconds()) + "Z"
    }, String.prototype.toJSON = Number.prototype.toJSON = Boolean.prototype.toJSON = function (a) {
        return this.valueOf()
    });
    var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
        escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
        gap, indent, meta = {
            "\b": "\\b",
            "	": "\\t",
            "\n": "\\n",
            "\f": "\\f",
            "\r": "\\r",
            '"': '\\"',
            "\\": "\\\\"
        }, rep;
    Faye.stringify = function (a, b, c) {
        var d;
        gap = "", indent = "";
        if (typeof c == "number") for (d = 0; d < c; d += 1) indent += " ";
        else typeof c == "string" && (indent = c);
        rep = b;
        if (!b || typeof b == "function" || typeof b == "object" && typeof b.length == "number") return str("", {
                "": a
            });
        throw new Error("JSON.stringify")
    }, typeof JSON.stringify != "function" && (JSON.stringify = Faye.stringify), typeof JSON.parse != "function" && (JSON.parse = function (text, reviver) {
        function walk(a, b) {
            var c, d, e = a[b];
            if (e && typeof e == "object") for (c in e) Object.hasOwnProperty.call(e, c) && (d = walk(e, c), d !== undefined ? e[c] = d : delete e[c]);
            return reviver.call(a, b, e)
        }
        var j;
        cx.lastIndex = 0, cx.test(text) && (text = text.replace(cx, function (a) {
            return "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4)
        }));
        if (/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]").replace(/(?:^|:|,)(?:\s*\[)+/g, ""))) return j = eval("(" + text + ")"), typeof reviver == "function" ? walk({
                "": j
            }, "") : j;
        throw new SyntaxError("JSON.parse")
    })
}(), Faye.Transport.WebSocket = Faye.extend(Faye.Class(Faye.Transport, {
    UNCONNECTED: 1,
    CONNECTING: 2,
    CONNECTED: 3,
    batching: !1,
    isUsable: function (a, b) {
        this.callback(function () {
            a.call(b, !0)
        }), this.errback(function () {
            a.call(b, !1)
        }), this.connect()
    },
    request: function (a, b) {
        if (a.length === 0) return;
        this._messages = this._messages || {};
        for (var c = 0, d = a.length; c < d; c++) this._messages[a[c].id] = a[c];
        this.callback(function (b) {
            b.send(Faye.toJSON(a))
        }), this.connect()
    },
    close: function () {
        if (this._closed) return;
        this._closed = !0, this._socket && this._socket.close()
    },
    connect: function () {
        if (Faye.Transport.WebSocket._unloaded) return;
        if (this._closed) return;
        this._state = this._state || this.UNCONNECTED;
        if (this._state !== this.UNCONNECTED) return;
        this._state = this.CONNECTING;
        var a = Faye.Transport.WebSocket.getClass();
        if (!a) return this.setDeferredStatus("failed");
        this._socket = new a(Faye.Transport.WebSocket.getSocketUrl(this.endpoint));
        var b = this;
        this._socket.onopen = function () {
            b._state = b.CONNECTED, b._everConnected = !0, b.setDeferredStatus("succeeded", b._socket), b.trigger("up")
        }, this._socket.onmessage = function (a) {
            var c = [].concat(JSON.parse(a.data));
            for (var d = 0, e = c.length; d < e; d++) delete b._messages[c[d].id];
            b.receive(c)
        }, this._socket.onclose = function () {
            var a = b._state === b.CONNECTED;
            b.setDeferredStatus("deferred"), b._state = b.UNCONNECTED, delete b._socket;
            if (a) return b.resend();
            if (!b._everConnected) return b.setDeferredStatus("failed");
            var c = b._client.retry * 1e3;
            Faye.ENV.setTimeout(function () {
                b.connect()
            }, c), b.trigger("down")
        }
    },
    resend: function () {
        if (!this._messages) return;
        var a = Faye.map(this._messages, function (a, b) {
            return b
        });
        this.request(a)
    }
}), {
    getSocketUrl: function (a) {
        return Faye.URI && (a = Faye.URI.parse(a).toURL()), a.replace(/^http(s?):/ig, "ws$1:")
    },
    getClass: function () {
        return Faye.WebSocket && Faye.WebSocket.Client || Faye.ENV.WebSocket || Faye.ENV.MozWebSocket
    },
    isUsable: function (a, b, c, d) {
        this.create(a, b).isUsable(c, d)
    },
    create: function (a, b) {
        var c = a.transports.websocket = a.transports.websocket || {};
        return c[b] = c[b] || new this(a, b), c[b]
    }
}), Faye.extend(Faye.Transport.WebSocket.prototype, Faye.Deferrable), Faye.Transport.register("websocket", Faye.Transport.WebSocket), Faye.Event && Faye.Event.on(Faye.ENV, "beforeunload", function () {
    Faye.Transport.WebSocket._unloaded = !0
}), Faye.Transport.EventSource = Faye.extend(Faye.Class(Faye.Transport, {
    initialize: function (a, b) {
        Faye.Transport.prototype.initialize.call(this, a, b);
        if (!Faye.ENV.EventSource) return this.setDeferredStatus("failed");
        this._xhr = new Faye.Transport.XHR(a, b);
        var c = new EventSource(b + "/" + a.getClientId()),
            d = this;
        c.onopen = function () {
            d._everConnected = !0, d.setDeferredStatus("succeeded"), d.trigger("up")
        }, c.onerror = function () {
            d._everConnected ? d.trigger("down") : (d.setDeferredStatus("failed"), c.close())
        }, c.onmessage = function (a) {
            d.receive(JSON.parse(a.data)), d.trigger("up")
        }, this._socket = c
    },
    isUsable: function (a, b) {
        this.callback(function () {
            a.call(b, !0)
        }), this.errback(function () {
            a.call(b, !1)
        })
    },
    request: function (a, b) {
        this._xhr.request(a, b)
    },
    close: function () {
        this._socket.close()
    }
}), {
    isUsable: function (a, b, c, d) {
        var e = a.getClientId();
        if (!e) return c.call(d, !1);
        Faye.Transport.XHR.isUsable(a, b, function (e) {
            if (!e) return c.call(d, !1);
            this.create(a, b).isUsable(c, d)
        }, this)
    },
    create: function (a, b) {
        var c = a.transports.eventsource = a.transports.eventsource || {};
        return c[b] = c[b] || new this(a, b), c[b]
    }
}), Faye.extend(Faye.Transport.EventSource.prototype, Faye.Deferrable), Faye.Transport.register("eventsource", Faye.Transport.EventSource), Faye.Transport.XHR = Faye.extend(Faye.Class(Faye.Transport, {
    request: function (a, b) {
        var c = this.retry(a, b),
            d = Faye.URI.parse(this.endpoint).pathname,
            e = this,
            f = Faye.ENV.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest;
        f.open("POST", d, !0), f.setRequestHeader("Content-Type", "application/json"), f.setRequestHeader("Pragma", "no-cache"), f.setRequestHeader("X-Requested-With", "XMLHttpRequest");
        var g = this.headers;
        for (var h in g) {
            if (!g.hasOwnProperty(h)) continue;
            f.setRequestHeader(h, g[h])
        }
        var i = function () {
            f.abort()
        };
        Faye.Event.on(Faye.ENV, "beforeunload", i);
        var j = function () {
            Faye.Event.detach(Faye.ENV, "beforeunload", i), f.onreadystatechange = function () {}, f = null
        };
        f.onreadystatechange = function () {
            if (f.readyState !== 4) return;
            var a = null,
                b = f.status,
                d = b >= 200 && b < 300 || b === 304 || b === 1223;
            if (!d) return j(), c(), e.trigger("down");
            try {
                a = JSON.parse(f.responseText)
            } catch (g) {}
            j(), a ? (e.receive(a), e.trigger("up")) : (c(), e.trigger("down"))
        }, f.send(Faye.toJSON(a))
    }
}), {
    isUsable: function (a, b, c, d) {
        c.call(d, Faye.URI.parse(b).isSameOrigin())
    }
}), Faye.Transport.register("long-polling", Faye.Transport.XHR), Faye.Transport.CORS = Faye.extend(Faye.Class(Faye.Transport, {
    request: function (a, b) {
        var c = Faye.ENV.XDomainRequest ? XDomainRequest : XMLHttpRequest,
            d = new c,
            e = this.retry(a, b),
            f = this;
        d.open("POST", this.endpoint, !0), d.setRequestHeader && d.setRequestHeader("Pragma", "no-cache");
        var g = function () {
            return d ? (d.onload = d.onerror = d.ontimeout = d.onprogress = null, d = null, Faye.ENV.clearTimeout(i), !0) : !1
        };
        d.onload = function () {
            var a = null;
            try {
                a = JSON.parse(d.responseText)
            } catch (b) {}
            g(), a ? (f.receive(a), f.trigger("up")) : (e(), f.trigger("down"))
        };
        var h = function () {
            g(), e(), f.trigger("down")
        }, i = Faye.ENV.setTimeout(h, 1500 * b);
        d.onerror = h, d.ontimeout = h, d.onprogress = function () {}, d.send("message=" + encodeURIComponent(Faye.toJSON(a)))
    }
}), {
    isUsable: function (a, b, c, d) {
        if (Faye.URI.parse(b).isSameOrigin()) return c.call(d, !1);
        if (Faye.ENV.XDomainRequest) return c.call(d, Faye.URI.parse(b).protocol === Faye.URI.parse(Faye.ENV.location).protocol);
        if (Faye.ENV.XMLHttpRequest) {
            var e = new Faye.ENV.XMLHttpRequest;
            return c.call(d, e.withCredentials !== undefined)
        }
        return c.call(d, !1)
    }
}), Faye.Transport.register("cross-origin-long-polling", Faye.Transport.CORS), Faye.Transport.JSONP = Faye.extend(Faye.Class(Faye.Transport, {
    shouldFlush: function (a) {
        var b = {
            message: Faye.toJSON(a),
            jsonp: "__jsonp" + Faye.Transport.JSONP._cbCount + "__"
        }, c = Faye.URI.parse(this.endpoint, b).toURL();
        return c.length >= Faye.Transport.MAX_URL_LENGTH
    },
    request: function (a, b) {
        var c = {
            message: Faye.toJSON(a)
        }, d = document.getElementsByTagName("head")[0],
            e = document.createElement("script"),
            f = Faye.Transport.JSONP.getCallbackName(),
            g = Faye.URI.parse(this.endpoint, c),
            h = this.retry(a, b),
            i = this;
        Faye.ENV[f] = function (a) {
            k(), i.receive(a), i.trigger("up")
        };
        var j = Faye.ENV.setTimeout(function () {
            k(), h(), i.trigger("down")
        }, 1500 * b),
            k = function () {
                if (!Faye.ENV[f]) return !1;
                Faye.ENV[f] = undefined;
                try {
                    delete Faye.ENV[f]
                } catch (a) {}
                return Faye.ENV.clearTimeout(j), e.parentNode.removeChild(e), !0
            };
        g.params.jsonp = f, e.type = "text/javascript", e.src = g.toURL(), d.appendChild(e)
    }
}), {
    _cbCount: 0,
    getCallbackName: function () {
        return this._cbCount += 1, "__jsonp" + this._cbCount + "__"
    },
    isUsable: function (a, b, c, d) {
        c.call(d, !0)
    }
}), Faye.Transport.register("callback-polling", Faye.Transport.JSONP);
(function () {
    function d() {
        function e() {
            a.publish("/service/ping")
        }
        if (!context.features.isRealtimeEnabled) return;
        Faye.ENV = window, Faye.MANDATORY_CONNECTION_TYPES.splice(1, 0, "cross-origin-long-polling"), a = new Faye.Client(context.realtime.serverUrl, {
            timeout: 90,
            retry: 15
        }), context.realtime.enableWebSockets || a.disable("websocket"), a.disable("eventsource");
        var d = {
            outgoing: function (a, c) {
                if (a.channel !== "/meta/subscribe") return c(a);
                a.ext || (a.ext = {}), a.ext.subscriptionToken = b[a.subscription].subscriptionData.token, c(a)
            }
        };
        setInterval(e, 6e4), a.addExtension(d), c = !0
    }
    function e(e) {
        if (!context.features.isRealtimeEnabled) return;
        e = e || {};
        for (var f in e) c || d(), b[f] || function (c) {
                var d = {
                    subscriptionData: e[c],
                    subscription: null
                };
                b[c] = d, d.subscription = a.subscribe(c, function (a) {
                    comm.send(a.eventType, a.eventData)
                })
        }(f)
    }
    function f(a) {
        var c = b[a];
        c && (c.subscription && c.subscription.cancel(), delete b[a])
    }
    function g() {
        for (var a in b) {
            var c = b[a].subscriptionData;
            c.persist || f(a)
        }
    }
    var a, b = {}, c = !1;
    comm.listen("spaceway.page.complete", function () {
        g(), e(context.realtime.subscriptions)
    }, !0), $(document).ready(function () {
        e(context.realtime.subscriptions)
    })
})();
(function (a) {
    function d(b) {
        b.animate({
            opacity: 0
        }, {
            duration: 1e3,
            complete: function () {
                a(this).remove()
            }
        })
    }
    function e(a, e) {
        function i() {
            d(a), clearTimeout(h)
        }
        function j() {
            a.stop().animate({
                opacity: 1
            }), clearTimeout(h)
        }
        function k() {
            var a = +(new Date) - g;
            f = Math.max(f - a, 2e3), h = setTimeout(i, f)
        }
        a.hide(), b.append(a), a.fadeIn().hover(j, k);
        var f = e || c,
            g = +(new Date),
            h = setTimeout(i, f)
    }
    var b = a("#toasts"),
        c = 15e3;
    comm.listen("toasts.new", function (b) {
        var c = a(b.html),
            f = a('<i class="close_14 close"></i>');
        f.click(function () {
            return d(c), !1
        }), c.prepend(f), e(c, b.timeout), b.onAdd && b.onAdd(c)
    }, !0), comm.listen("toasts.remove", function (a) {
        a && a.length && d(a)
    }, !0)
})(jQuery);
(function (a) {
    function b(a) {
        var b = !1;
        a.click(function (c) {
            b || (Myspace.Notifications.markAsViewed(a), b = !0), Myspace.Notifications.onClick(a, c)
        }), Myspace.ToolTip(a)
    }
    comm.listen("notificationsv3.new", function (b) {
        setTimeout(function () {
            a.ajax({
                url: "/ajax/notifications/realtime",
                type: "POST",
                data: b
            }).done(function (a) {
                comm.send("notifications.new.render", a)
            })
        }, 500)
    }, !0), comm.listen("notifications.new.render", function (a) {
        a.popupHtml && comm.send("toasts.new", {
            html: a.popupHtml,
            onAdd: b
        })
    }, !0)
})(jQuery);
(function (a) {
    function f() {
        d = !1, c !== b.Hidden && g(b.Online), a(window).off(e, f)
    }
    function g(a) {
        c = a, scomm.ready(function () {
            scomm.send("presence.state", {
                presence: c
            })
        })
    }
    function h() {
        a.ajax({
            url: "/ajax/presence/set",
            type: "POST",
            data: {
                presence: c,
                client: "web"
            }
        })
    }
    function i() {
        return c
    }
    function j() {
        Myspace.User.isLoggedIn && l(), Myspace.User.isLoggedIn && context.features.isRenderPresenceEnabled && m()
    }
    function l() {
        var i = Myspace.Utils.guid();
        g(context.messaging.settings.IsIMEnabled ? b.Online : b.Hidden), scomm.add(function (a, e) {
            a === "presence.state" && c !== e.presence && (e.presence === b.Idle && !d ? scomm.send("presence.state", {
                presence: c
            }) : c = e.presence)
        }), comm.listen("page.idle", function (h) {
            if (h < 3) return;
            d = !0, c !== b.Hidden && g(b.Idle), a(window).off(e, f).on(e, f)
        }, !0), comm.listen("presence.sethidden", function (a) {
            var c = a ? b.Hidden : b.Online;
            g(c), h()
        }, !0), a(window).on("beforeunload", function () {
            Object.keys(k).length === 0 && c !== b.Hidden && (g(b.Offline), h()), scomm.send("presence.tab", {
                tabId: i,
                event: "close"
            })
        }), scomm.add(function (a, b) {
            a === "presence.tab" && (b.event === "open" ? k[b.tabId] || (k[b.tabId] = !0, scomm.send("presence.tab", {
                tabId: i,
                event: "open"
            })) : b.event === "close" && delete k[b.tabId])
        }), scomm.ready(function () {
            scomm.send("presence.tab", {
                tabId: i,
                event: "open"
            })
        })
    }
    function m() {
        function c(c) {
            function f(a, c) {
                a.removeClass("presence online idle");
                switch (c && c.status) {
                    case b.Online:
                        a.addClass("presence online");
                        break;
                    case b.Idle:
                        a.addClass("presence idle")
                }
            }
            var d = {};
            c.find("[data-show-presence=true]").each(function () {
                var b = a(this);
                if (!b.data("isPresenceSet")) {
                    var c = b.data("profileid") || b.find(".connectButton").data("id");
                    c = Number(c), c && (d[c] = (d[c] || a()).add(b)), b.data("isPresenceSet", !0)
                }
            });
            var e = Object.keys(d);
            e.length && a.ajax({
                url: "/ajax/presence/get",
                type: "POST",
                data: {
                    profileIds: e
                }
            }).done(function (a) {
                e.forEach(function (b) {
                    var c = d[b],
                        e = a[b];
                    f(c, e)
                })
            })
        }
        comm.listen("page.changed", c, !0), setTimeout(function () {
            c(a("#wrap"))
        }, 1e3)
    }
    var b = {
        Online: "Online",
        Idle: "Idle",
        Offline: "Offline",
        Hidden: "Hidden"
    }, c, d = !1,
        e = "mousemove keyup focus",
        k = {};
    j(), Myspace.Presence = {
        getCurrentPresence: i
    }
})(jQuery);
(function (a) {
    comm.listen("highlights.new", function (b) {
        a.ajax({
            url: "/ajax/highlights/render",
            type: "POST",
            data: {
                type: b.type,
                data: b.data
            }
        }).done(function (b) {
            function c(b) {
                var c = b.data("highlight-type");
                comm.send("track", new Tracking("Highlights", c, "Show")), b.click(function (b) {
                    comm.send("track", new Tracking("Highlights", c, "Click"));
                    if (b.target.nodeName === "A") return !0;
                    var d = a(this).find("a").first();
                    return comm.send("location.href", d.attr("href")), !1
                })
            }
            comm.send("toasts.new", {
                html: b,
                onAdd: c
            })
        })
    }, !0)
})(jQuery);
(function (a) {
    a("body").delegate(".mediaItems.table > li", "click", function (b) {
        var c = a(this),
            d = a(b.target);
        if (!c.hasClass("heading") && !d.hasClass("delete") && !d.is("a") && !c.hasClass("editForm") && c.data("disablerr") === undefined) {
            if (!c.hasClass("selected")) {
                a("ol.table > li.selected").removeClass("selected"), c.addClass("selected");
                var e = objectify(c.find(".playBtn:first"));
                e && (e.influencerId = Myspace.Influencer.getClickInfluencer(c), e.explicit = !0), comm.send("rightRail.info", e)
            } else comm.send("rightRail.show");
            b.stopPropagation()
        } else if (d.hasClass("delete")) {
            var f = c.closest(".table"),
                g = {}, h = objectify(d),
                i = f.data("totalrecords");
            g.playlistId = f.data("playlistid"), g.objectVersion = f.data("objectversion"), g.mediaId = h.songId, g.mediaId || (g.mediaId = h.mediaId), g.mediaType = h.mediaType, g.sequenceId = h.sequenceId, g.totalRecords = i - 1, c.remove(), f.data("totalrecords", i - 1), comm.send("mix.removeItem", g)
        }
    }), a("#container > #wrap").on("click", "a[data-type=video]", function (b) {
        var c = a(b.target),
            d = c.closest("a").attr("href"),
            e = d.slice(d.lastIndexOf("/") + 1);
        return comm.send("influencer.click", c), comm.send("videoLightbox.instance", function (b) {
            if (b) {
                var c = a("#container > #wrap").find(".playBtn.video[data-media-id=" + e + "]").first(),
                    f = c.length ? objectify(c) : null;
                b.show(f, {
                    detailUrl: d
                })
            } else context.pfc !== "videodetail" && (Myspace.videoReferrer = window.location.pathname), comm.send("location.href", d)
        }), !1
    })
})(jQuery);
(function (a) {
    function b(a, b) {
        var c = {
            entityKey: a
        }, d = b.find('[itemprop="name"]'),
            e = b.find('[itemprop="byArtist"]'),
            f = b.find('[itemprop="image"]');
        return d.length && (c.title = d.text()), e.length && (c.owner = e.text()), f.length && (c.imageUrl = f.attr("content") || f.attr("src")), c
    }
    comm.listen("share", function (c) {
        var d = a(c.source),
            e = c.type,
            f = d.closest(".connectButton"),
            g, h, i, j;
        if (!Myspace.User.isLoggedIn) return comm.send("login.prompt", {
                action: "share",
                object: c.entityKey
            });
        if (e !== "photo" && c.entityKey && c.imageUrl && c.title) return comm.send("superpost", {
                element: d,
                object: c,
                type: e
            });
        f.length && (g = f.siblings(".playBtn").first());
        if (!g || !g.length) g = c.source.parents(".media,.mediaSquare,.streamItem").find(".playBtn");
        if (!g.length) {
            switch (e) {
                case "song":
                    h = '[itemtype="http://schema.org/MusicRecording"]';
                    break;
                case "album":
                    h = '[itemtype="http://schema.org/MusicAlbum"]';
                    break;
                case "mixtape":
                    h = '[itemtype="http://schema.org/MusicPlaylist"]';
                    break;
                case "video":
                    h = '[itemtype="http://schema.org/MusicVideoObject"]';
                    break;
                case "radio":
                    h = '[itemtype="http://schema.org/MusicGroup"]';
                    break;
                case "profile":
                    h = '[itemtype="http://schema.org/Person"]'
            }
            h && (i = d.closest(h), g = i.find(".playBtn").first())
        }
        g.length ? j = objectify(g) : i && i.length ? (j = b(c.entityKey, i), e = "share") : f.length ? (g = f.parent().children(".mediaSquare").first().find(".playBtn"), j = g.length ? objectify(g) : objectify(f), e = "share") : j = objectify(d), comm.send("superpost", {
            element: d,
            object: j,
            type: e
        })
    }, !0)
})(jQuery);
(function (a) {
    function f(c) {
        if (!c) return;
        c.pggd || (c.pggd = context.beaconData.pggd, c.prid = context.beaconData.prid), a.cors(b, {
            data: JSON.stringify(c),
            contentType: "text/plain"
        })
    }
    function g() {
        context.beaconData.tzo = (new Date).getTimezoneOffset(), f(context.beaconData)
    }
    function h() {
        try {
            return localStorage.activePlayer == scomm.hash
        } catch (a) {}
        return !0
    }
    function i() {
        return e("incognito") == 1 ? "1" : "0"
    }
    var b = config.urls.beacon,
        c = {}, d = {}, e = new CookieHelper("player");
    g(), comm.listen("player.loading", function (a) {
        c = a.mediaItem, d = {}
    }, !0), comm.listen("player.time", function (a) {
        if (c.private || !h()) return;
        if (c.mediaType == "audio") {
            if (a.time >= 30 && !d["30-seconds"]) {
                d["30-seconds"] = 1;
                var b = {
                    dsid: 505,
                    dsv: 1,
                    cid: c.songId,
                    crid: c.mediaReleaseId,
                    "in": i(),
                    i: c.influencerId || ""
                };
                c.sourceEntityKey && (b.skey = c.sourceEntityKey), f(b)
            }
        } else if (c.mediaType == "video" && a.time >= 30 && !d["30-seconds"]) {
            d["30-seconds"] = 1;
            var b = {
                dsid: 501,
                dsv: 1,
                cid: c.mediaId,
                crid: c.mediaReleaseId,
                "in": i(),
                cl: c.duration[0],
                i: c.influencerId || ""
            };
            c.sourceEntityKey && (b.skey = c.sourceEntityKey), f(b)
        }
    }, !0), comm.listen("beacon", function (a) {
        f(a)
    }, !0), comm.listen("spaceway.page.complete", function () {
        g()
    }, !0), comm.listen("photo.view", function (a) {
        a.dsid = 506, a.dsv = 1, f(a)
    }, !0)
})(jQuery);
(function () {
    function c(a) {
        var b = {};
        return Object.keys(a).sort().forEach(function (c) {
            b[c] = a[c]
        }), JSON.stringify(b)
    }
    function d(d) {
        var e = {
            abTestsText: null,
            beaconVersionValue: 2,
            currentCultureCode: context.beaconData.currentCultureCode,
            currentLatitudeDegrees: 34.076212,
            currentLongitudeDegrees: -118.393564,
            currentUserLoginId: context.beaconData.currentUserLoginId || null,
            currentUserProfileId: context.beaconData.currentUserProfileId || null,
            externalSourceText: null,
            incognitoIndicator: b("incognito") || !1,
            ipDerivedIsoCountryCode: context.ipDerivedIsoCountryCode,
            ipDerivedLocationId: context.ipDerivedLocationId,
            lastLoginId: context.beaconData.lastLoginId,
            lastLoginUtcDateTime: context.beaconData.lastLoginUtcDateTime,
            lastProfileId: context.beaconData.lastProfileId,
            originalReferrerText: null,
            pageFunctionalContextText: context.beaconData.pageFunctionalContextText,
            pageId: context.beaconData.pageId,
            persistentId: context.beaconData.persistentId,
            referrerPageFunctionalContextText: context.beaconData.rpf || null,
            referrerUrl: context.beaconData.referrerUrl || null,
            visitId: context.beaconData.visitId,
            webServerIPAddressId: context.beaconData.webServerIPAddressId,
            webServerName: context.beaconData.webServerName
        };
        $.extend(d, e), $.cors(a, {
            data: c(d),
            contentType: "text/plain"
        })
    }
    var a = config.urls.beacon,
        b = new CookieHelper("player");
    comm.listen("beacon.v2", d, !0)
})();
(function (a) {
    var b = {};
    comm.listen("scraper.invoke", function (c) {
        function g(a) {
            b[d.toLowerCase()] = a, a.loadFailed ? e(null, null) : e(null, a)
        }
        function h(a) {
            e(null, null)
        }
        var d = c.url,
            e = c.callback,
            f;
        d ? (f = b[d.toLowerCase()], f ? e(null, f.loadFailed ? null : f) : a.ajax({
            url: "/ajax/stream/scrape",
            data: {
                url: d
            },
            type: "POST",
            timeout: 3e4
        }).done(g).fail(h)) : e(null, null)
    })
})(jQuery);
(function (a) {
    function d() {
        var a = "https?://",
            b = "(?:(?:[0-9]|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])\\.){3}(?:[0-9]|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])",
            c = "(?:(?:[^\\s!@#$%^&*()_=+[\\]{}\\\\|;:'\",.<>/?]+)\\.)+",
            d = "(?:ac|ad|aero|ae|af|ag|ai|al|am|an|ao|aq|arpa|ar|asia|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|biz|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|cat|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|coop|com|co|cr|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|info|int|in|io|iq|ir|is|it|je|jm|jobs|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mil|mk|ml|mm|mn|mobi|mo|mp|mq|mr|ms|mt|museum|mu|mv|mw|mx|my|mz|name|na|nc|net|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pro|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tel|tf|tg|th|tj|tk|tl|tm|tn|to|tp|travel|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|xn--0zwm56d|xn--11b5bs3a9aj6g|xn--80akhbyknj4f|xn--9t4b11yi5a|xn--deba0ad|xn--g6w251d|xn--hgbk6aj7f53bba|xn--hlcj6aya9esc7a|xn--jxalpdlp|xn--kgbechtv|xn--zckzah|ye|yt|yu|za|zm|zw)",
            e = "(?:" + c + d + "|" + b + ")",
            f = "(?:[;/][^#?<>\\s]*)?",
            g = "(?:\\?[^#<>\\s]*)?(?:#[^<>\\s]*)?",
            h = a + "[^<>\\s]+",
            i = "\\b" + e + f + g + "(?!\\w)";
        return new RegExp("(?:" + h + "|" + i + ")", "ig")
    }
    function e(a, c, d, e) {
        var g, h, i;
        a = a.trim(), e = e || -1;
        if (a) {
            b.lastIndex = d || 0, g = b.exec(a);
            if (g) {
                h = g[0];
                if (e < g.index || e > g.index + h.length) i = !0, h.indexOf("http://") !== 0 && h.indexOf("https://") !== 0 && (h = "http://" + h), f(h, c, a, b.lastIndex, e)
            }
        }!i && setTimeout(function () {
            c(null, null)
        }, 0)
    }
    function f(a, b, c, d, f) {
        comm.send("scraper.invoke", {
            url: a,
            callback: function (a, g) {
                g ? b(null, g) : e(c, b, d, f)
            }
        })
    }
    function g(b, d) {
        function m(b) {
            h = a("<div/>").addClass("linkPreviewerLoader"), b.forEach(function (b) {
                l && b.indexOf("https://") !== 0 ? a.ajax({
                    url: "/ajax/stream/scrape/image?url=" + b,
                    type: "GET",
                    timeout: 4e3
                }).done(function (c) {
                    c.data && a('<img src="' + c.data + '" data-url="' + b + '" />').bind("load", n).bind("error", o).appendTo(h)
                }) : a('<img src="' + b + '" data-url="' + b + '" />').bind("load", n).bind("error", o).appendTo(h)
            }), h.appendTo(document.body), i && setTimeout(p, 5e3)
        }
        function n(b) {
            var c = a(this),
                d, e;
            if (j) return;
            d = c.outerHeight(), e = c.outerWidth(), isGoodImageSize = e >= 50 && d >= 50 && e / d <= 3 && d / e <= 3, isGoodImageSize && (c.attr("data-org-height", d).attr("data-org-width", e), g.push(c)), i--, i == 0 && p()
        }
        function o() {
            if (j) return;
            i--, i == 0 && p()
        }
        function p() {
            var b = g.length,
                c;
            if (j) return;
            j = !0, b ? (b > 1 ? (g.sort(function (a, b) {
                var c = a.attr("data-org-height"),
                    d = a.attr("data-org-width"),
                    e = parseInt(c, 10) * parseInt(d, 10);
                return h2 = b.attr("data-org-height"), w2 = b.attr("data-org-width"), area2 = parseInt(h2, 10) * parseInt(w2, 10), e < area2 ? 1 : e > area2 ? -1 : 0
            }), f.find(".arrow_left_16_dark").click(function () {
                q(a(this))
            }), f.find(".arrow_right_16_dark").click(function () {
                q(a(this), !0)
            })) : f.addClass("singleImage"), q()) : f.addClass("noImage"), f.removeClass("processing").children("div").removeClass("loading"), h.remove(), h = null
        }
        function q(a, b) {
            var c = g.length - 1;
            a && (b ? k < c && (k++, k == c && a.addClass("disabled"), k == 1 && a.prev().removeClass("disabled")) : k > 0 && (k--, k == 0 ? a.addClass("disabled") : k == c - 1 && a.next().removeClass("disabled"))), c > 0 && f.find(".preview_count").text(k + 1 + " of " + (c + 1)), f.children("div").html("").append(g[k])
        }
        var e, f, g = [],
            h, i, j, k = 0,
            l = location.protocol === "https:";
        c || templates && (e = templates["common/views/generic/superpost/_linkpreview"]) && (c = require("ejs").compile(e)), c && (f = a(c(d)), d.images && (i = d.images.length) && m(d.images), f.find("input").click(function () {
            f.toggleClass("hideImage")
        }), b.append(f))
    }
    var b, c;
    b = d(), comm.listen("scraper.bind", function (b) {
        function k() {
            if (j) return;
            var a = d ? c.val() : c.text(),
                b = d ? null : window.getSelection();
            h && clearTimeout(h), e(a, function (a, b) {
                var d;
                b ? (j = !0, i.previewContainer && g(i.previewContainer, b), i.onScrape(b)) : document.activeElement == c[0] && (h = setTimeout(k, 500))
            }, 0, document.activeElement == c[0] && (d ? c[0].selectionStart : b.anchorNode && b.anchorNode.nodeType == 3 ? b.anchorOffset : -1))
        }
        var c = a(b.el),
            d = c[0].tagName === "TEXTAREA",
            f = b.callback,
            h, i, j;
        c.focus(k), i = {
            start: function () {
                j = !1, k()
            },
            stop: function () {
                h && clearTimeout(h)
            },
            onScrape: function () {},
            previewContainer: null
        }, f && f(i)
    }, !0), comm.listen("scraper.haslink", function (a) {
        var c = a.input,
            d = a.callback;
        b.lastIndex = 0, d && d(b.test(c))
    }, !0)
})(jQuery);
(function (a) {
    function d(d, e, f) {
        function r(a) {
            l = null, m = null;
            var b = window.getSelection();
            s(e.firstChild, b.anchorNode, b.anchorOffset, a), l && b.collapse(l, m), t()
        }
        function s(a, b, c, d) {
            if (!a) return;
            var e = a.nextSibling,
                f = a.previousSibling,
                g = a.nodeType,
                h, i, j, k;
            if (g == 1 && !y(a, b, d)) {
                h = a.parentNode, i = a.firstChild;
                if (!i) a.tagName != "BR" && (a.tagName == "DIV" ? (k = document.createElement("br"), h.replaceChild(k, a)) : h.removeChild(a), b == a && f && (l = k || f, m = l.nodeType === 3 ? l.nodeValue.length : 1)), s(e, b, c, d);
                else {
                    a.tagName == "DIV" && (i.nodeType != 1 || i.nodeType == 1 && i.tagName != "BR") && h.insertBefore(document.createElement("br"), a);
                    while (a.childNodes.length) h.insertBefore(a.childNodes[0], a);
                    s(i, b, c, d)
                }
                return
            }
            g != 3 && g != 1 ? a.parentNode.removeChild(a) : g == 3 && f && f.nodeType == 3 && (b == a && (j = f.nodeValue.length), f.nodeValue += a.nodeValue, a.parentNode.removeChild(a), j && (l = f, m = j + c)), e && s(e, b, c, d)
        }
        function t() {
            var c = window.getSelection(),
                d, f, k, l, m, n, o;
            c && c.isCollapsed && (c.anchorNode == e && (m = e.childNodes[c.anchorOffset - 1], m && m.nodeType == 3 && c.collapse(m, m.nodeValue.length)), d = c.anchorNode, f = c.anchorOffset, d && d.nodeType === 3 && (k = d.nodeValue.substring(0, f), l = k && k.lastIndexOf("@"), l < 0 && (l = k && k.lastIndexOf("/")), n = l >= 0 && k.substring(l + 1, f))), n && n.length > 1 ? (g = n, h = d, i = l, j = f, o = b[n], o ? u(o.slice(0, o.length), n) : a.ajax({
                url: "/ajax/stream/mentionq",
                data: {
                    q: n
                },
                type: "POST"
            }).done(function (a) {
                a && a.length ? (b[n] = a, u(a.slice(0, a.length), n)) : z()
            }).fail(function () {
                z()
            })) : z()
        }
        function u(b, f) {
            var l = window.getSelection(),
                m, p, r, s, t, u, w, y, C = {}, D, E;
            if (b && (w = b.length) && l && l.isCollapsed && g == f && l.anchorNode == h && l.anchorOffset == j) {
                r = h.nodeValue, u = f.length, h.nodeValue = r.substring(0, i + 1), m = document.createElement("span"), m.className = "mentionq", k = document.createTextNode(f), m.appendChild(k), p = h.nextSibling, p ? e.insertBefore(m, p) : e.appendChild(m), s = r.substring(i + 1 + u), s && (t = document.createTextNode(s), p ? e.insertBefore(t, p) : e.appendChild(t)), l.collapse(k, u), o || A(), d.find("span[data-ms-allowed]").each(function () {
                    var b = a(this).attr("data-id");
                    n[b] && (C[b] = n[b])
                }), n = C;
                for (var F = 0; F < w; F++) y = b[F], n[y.profileId] && (b.splice(F, 1), F--, w--);
                D = c(b), E = a(D).mouseover(function () {
                    var b = a(this),
                        c = b.index();
                    c != q && (b.addClass("selected"), q > -1 && a(o.children()[q]).removeClass("selected"), q = c)
                }).click(function (a) {
                    return x(this, a), !1
                }), q = 0, o.empty().append(E).addClass("show").scrollTop(0), o.find("li.publicProfile").index() == 0 && (q = 1), v(m), a(document).click(B);
                return
            }
            z()
        }
        function v(b) {
            var c = o.outerWidth(!0),
                e = o.outerHeight(!0),
                g = a(b).offset(),
                h = (parseInt(d.css("lineHeight")) || 0) + 10,
                i = g.top + h,
                j = g.left - h / 2,
                k = a(window),
                l = {
                    top: "",
                    bottom: "",
                    left: "",
                    right: ""
                };
            if (j + c >= k.width()) {
                j = g.left - c + h / 2;
                if (f) {
                    var m = d.parent().offset();
                    m && (j = m.left + 5)
                }
            }
            l.left = j, i + e >= k.height() ? l.bottom = k.height() - g.top + 5 : l.top = i, o.css(l)
        }
        function w(b) {
            var c, d, e, f, g, h;
            o && o.hasClass("show") && (c = o.children(), d = c.length, d && (b ? e = q > 0 : q < d - 1 && (e = !0), e && (a(c[q]).removeClass("selected"), b ? --q : ++q, f = c[q], a(f).hasClass("publicProfile") && (b ? --q : ++q, q > 0 && q < d - 1 ? f = c[q] : f = c[q]), g = o.scrollTop(), h = b ? g - f.offsetTop : f.offsetTop + f.offsetHeight - o.innerHeight() - g, a(f).addClass("selected"), h > 0 && o.scrollTop(b ? g - h : g + h))))
        }
        function x(b, c) {
            var d = a(b),
                f = d.attr("data-id"),
                g = k.parentNode,
                h = g.previousSibling,
                i = g.nextSibling,
                j = h.nodeValue,
                l, m, o, p = window.getSelection();
            if (!f) return;
            m = d.find("strong").text(), o = d.find("p[username]").text(), k.nodeValue = m, h.nodeValue = j.substring(0, j.length - 1), i && i.nodeType == 3 ? (i.nodeValue = " " + i.nodeValue, l = i) : (l = document.createTextNode(" "), i ? e.insertBefore(l, i) : e.appendChild(l)), g.setAttribute("data-ms-allowed", "1"), g.setAttribute("data-id", f), g.setAttribute("data-selected", !0), z(), e.focus(), setTimeout(function () {
                p.collapse(l, 1)
            }, 0), n[f] = {
                id: f,
                key: d.attr("data-entity-key"),
                text: m,
                userName: o
            }
        }
        function y(a, b, c) {
            var d;
            return a.getAttribute("data-ms-allowed") ? !c || a != b && b.parentNode != a ? !0 : (d = a.getAttribute("data-id"), a.removeAttribute("data-ms-allowed"), n[d] && delete n[d], !1) : !1
        }
        function z() {
            o && o.removeClass("show").empty(), a(document).unbind("click", B)
        }
        function A() {
            var b = a(document.body).find("ul.mentionDropDown.slats.small");
            b.length && a(b).remove(), o = a("<ul/>").addClass("mentionDropDown slats small").appendTo(document.body).scroll(function () {
                document.activeElement != e && window.getSelection().collapse(k, k.nodeValue.length)
            }), c || (c = require("ejs").compile(templates["common/views/generic/superpost/_mention"]))
        }
        function B(b) {
            o && o.hasClass("show") && document.activeElement !== e && b.target != o[0] && !a.contains(o[0], b.target) && z()
        }
        function C() {
            n = {}, z(), o = null
        }
        function D() {
            return n
        }
        function p() {
            return p
        }
        var e = e ? e : d[0],
            g, h, i, j, k, l, m, n = {}, o, p, q = -1;
        return d.blur(function (a) {
            var b;
            b = e.firstChild, b && b.tagName == "BR" && e.removeChild(b), g = ""
        }).keydown(function (a) {
            var b = a.which,
                c, d, f;
            p = !1;
            if (b == 38 || b == 40) {
                c = window.getSelection(), d = c.anchorNode, f = c.anchorOffset, d == e && f > 0 && (d = e.childNodes[f - 1]);
                if (d == k || d == k.parentNode) return w(b == 38), !1
            } else {
                if (b == 13 && o && o.hasClass("show")) return q > -1 && (p = !0, x(o.children()[q], a)), !1;
                b == 27 && (!o || !o.hasClass("show")) && comm.send("page.esc")
            }
        }).keyup("keyup", function (a) {
            a.stopPropagation();
            var b = a.which;
            (b == 37 || b == 39) && r(!1)
        }).click(function () {
            setTimeout(function () {
                r(!1)
            }, 0)
        }).bind("input", function () {
            setTimeout(function () {
                r(!0)
            }, 0)
        }), d.parent().addClass("mentions"), a(window).resize(function () {
            z()
        }), {
            reset: C,
            mentionProfileList: D,
            isProfileSelectByEnterKey: p
        }
    }
    var b = {}, c;
    Myspace = window.Myspace || {}, Myspace.mention = d
})(jQuery);
(function (a) {
    function f(d, e) {
        function u(a, b) {
            var c = a.which,
                d, e, f = !0,
                g;
            if (c !== 8) return d = b ? i.val(undefined, !0) : y().trimStart(), e = d.length, b || ++e, e > k && (g = d.substring(0, k), i.val(g), v(d, g), e = k, f = !1), l && x(e), f
        }
        function v(a, d) {
            var f, g, h;
            if (!e.showUrlCutOffWarning) return;
            f = a.substring(k), c.lastIndex = 0, b.lastIndex = 0, g = c.exec(d), g && (h = b.exec(f), h && comm.send("scraper.haslink", {
                input: g[0] + h[0],
                callback: w
            }))
        }
        function w(b) {
            var c;
            b && (p || (p = a('<span class="urlcutoff">Warning! Some portion of url at the end of the post are removed because of limit restrictions. Please verify your post.</span>'), c = a('<i class="x_14"></i>').click(function () {
                d.removeClass("urlcutoffwarning")
            }).appendTo(p), p.insertAfter(d).show()), d.addClass("urlcutoffwarning"))
        }
        function x(a) {
            n.html(a + "/" + k)
        }
        function y() {
            return q ? d.val() : d.text()
        }
        function z(b) {
            b = a.trim(b) === "" ? f : b, q ? d.val(b) : d.text(b), l && x(b.trim().length)
        }
        function A() {
            z(""), d.removeClass("urlcutoffwarning"), r && r.reset()
        }
        var f, g, h, i, j, k, l, m, n, o, p, q, r, s = function (a) {
                var b = h.scrollHeight,
                    c = h.clientHeight;
                g && clearTimeout(g), b < j && b > c ? d.css("height", b + "px") : b > j && c < j && d.css("height", j + "px"), a || (g = setTimeout(function () {
                    s()
                }, 200))
            }, t;
        d = a(d);
        if (!d.length) return;
        h = d[0], q = h.tagName === "TEXTAREA";
        if (!q && d.attr("contenteditable") != "true") return;
        return i = d.data("instance"), i ? i : (e = e || {}, e.defaultValue && d.attr("placeholder", e.defaultValue), f = "", j = e.maxHeight || 100, k = e.maxLength ? parseInt(e.maxLength) : 0, l = e.showCount, m = e.countPos || "topLeft", t = !q || e.showMentions, d.focus(function () {
            typeof e.focus == "function" && e.focus()
        }).blur(function (a) {
            var b;
            g && clearTimeout(g), typeof e.blur == "function" && e.blur(a), k && u(a, !0)
        }).bind("paste", function (a) {
            k && setTimeout(function () {
                u(a, !0)
            }, 0)
        }).bind("mousewheel", function (a) {
            a.stopPropagation()
        }).keypress(function (a) {
            var b = !0,
                c = !0;
            if (a.which !== 13 || typeof e.enter != "function") {
                if (k) var b = u(a);
                return typeof e.keypress == "function" && (c = e.keypress(a)), b && c
            }
            e.enter(), d.blur()
        }).keyup(function (a) {
            if (a.which === 8) {
                if (k && l) {
                    var b = i.val(undefined, !0).length;
                    x(b)
                }
                typeof e.backspace == "function" && e.backspace(a)
            }
        }), e.enableScrapeLink && comm.send("scraper.bind", {
            el: d,
            callback: function (a) {
                o = a, e.previewContainer && (o.previewContainer = e.previewContainer), typeof e.onScrape == "function" && (o.onScrape = e.onScrape)
            }
        }), t ? r || (r = Myspace.mention(d)) : d.parent() && d.parent().removeClass("mentions"), i = {
            val: function (a, b) {
                var c, d;
                if (typeof a == "undefined") return t && !b ? (c = y().trimStart(), d = r && r.mentionProfileList(), Object.keys(d).forEach(function (a) {
                        var b = d[a];
                        c = c.replace(b.text, "[[" + b.text + "]]")
                    }), c) : y().trimStart();
                z(a)
            },
            focus: function () {
                d.focus()
            },
            blur: function () {
                d.blur()
            },
            resize: function () {
                s(!0)
            },
            placeholder: function (a) {
                typeof a != "undefined" && d.attr("placeholder", a)
            },
            reset: A,
            getMentions: function () {
                return r && r.mentionProfileList()
            }
        }, l && (n = a("<span class='" + m + "'>" + i.val(undefined, !0).length + "/" + k + "</span>").appendTo(d.parent())), d.data("instance", i), i)
    }
    var b = /^[^\n\s]+/,
        c = /[^\n\s]+$/,
        d = /\n/g,
        e = /\n$/;
    Myspace = window.Myspace || {}, Myspace.postControl = f
})(jQuery);
(function (a) {
    var b = function (b, c) {
        function I(b) {
            var c = b.which;
            D = !0, c != 38 && c != 40 && c != 27 && (c == 13 || c == 9 ? (C && B > -1 && (X(A.children()[B], b), b.preventDefault()), c == 9 && W()) : j && (f || e) && (E || (E = !0, n && n()), L(), K())), u && u(b), w && a.trim(d.val()) === "" && M()
        }
        function J(a) {
            var b = a.which;
            (b == 38 || b == 40) && R(b == 38)
        }
        function K() {
            y = setTimeout(N, i)
        }
        function L() {
            y && clearTimeout(y)
        }
        function M() {
            H = undefined
        }
        function N(b) {
            var c = j ? a.trim(d.val() || d.text()).toLowerCase() : "";
            w && c.substr(0, 2) !== F.substr(0, 2) && M();
            if ((c != F || !C) && (f && f.length || c && c.length >= h)) {
                F = c;
                if (z[c]) Q(z[c], c);
                else if (f && f.length) if (!c) b && Q(f, c);
                    else {
                        var g, i = [];
                        for (var k in f) {
                            g = f[k].text;
                            if (!g) continue;
                            g = g.toLowerCase(), g.indexOf(c) == 0 && i.push(f[k])
                        }
                        Q(i, c)
                    } else if (e) {
                    function l(a, b, e) {
                        if (w) {
                            var f = e.getResponseHeader("X-SearchSessionId");
                            f && (H = f)
                        }
                        if (c !== F) return;
                        if (!D) {
                            d.removeClass("loadingAutoComplete");
                            return
                        }
                        var g = a.data || [];
                        r ? r(g, function (a) {
                            g = a, Q(g, c)
                        }) : Q(g, c)
                    }
                    function m() {
                        d.removeClass("loadingAutoComplete")
                    }
                    P();
                    if (typeof e == "function") e(c, l, m);
                    else {
                        w && (q.ssid = H);
                        var n = a.extend({
                            query: c
                        }, q);
                        a.ajax({
                            type: "POST",
                            url: e,
                            success: l,
                            error: m,
                            data: n
                        })
                    }
                }
            } else c === "" && (s && s(function (a) {
                    a && Q(a, c)
                }), w && M())
        }
        function O() {
            var b = o[0],
                c = b.offsetLeft - 1,
                e = o.offsetParent(),
                f = e.css("position");
            A = a("<ul/>").addClass("autoCompleteList").insertAfter(d).css(k ? "width" : "min-width", o.innerWidth() + "px").scroll(function () {
                document.activeElement != d[0] && d[0].focus()
            }), f !== "absolute" && f !== "relative" && f !== "fixed" && e.css("position", "relative"), A.css("left", c), p && A.addClass(p), A.bind("mousewheel", function (a) {
                a.stopPropagation()
            })
        }
        function P() {
            d.addClass("loadingAutoComplete")
        }
        function Q(b, c) {
            d.removeClass("loadingAutoComplete"), A || O();
            if (b.length) {
                z[c] = b;
                var e = A.innerHeight() || 100;
                A.empty(), S();
                if (!x) {
                    if (!require) return;
                    x = require("ejs").compile(g)
                }
                var f = a(x(b)).appendTo(A).mouseover(function () {
                    var b = a(this),
                        c = b.index();
                    c != B && (b.addClass("selected"), B > -1 && a(A.children()[B]).removeClass("selected"), B = c)
                }).click(function (a) {
                    return X(this, a), v
                });
                B = -1, A.css("height", f.length ? "auto" : e).scrollTop(0)
            } else A.html('<li style="white-space: normal;">' + G + "</li>"), S()
        }
        function R(b) {
            if (!A || j) {
                L(), N(!0);
                if (!A) return
            }
            S();
            var c = A.children(),
                d = c.length,
                e;
            if (d) {
                b ? B > 0 && (e = !0) : B < d && (B == d - 1 && --B, e = !0);
                if (e) {
                    a(c[B]).removeClass("selected"), b ? --B : ++B;
                    var f = c[B],
                        g = A.scrollTop(),
                        h = b ? g - f.offsetTop : f.offsetTop + f.offsetHeight - A.innerHeight() - g;
                    a(f).addClass("selected"), h > 0 && A.scrollTop(b ? g - h : g + h)
                }
            }
        }
        function S() {
            C || (A.show(), C = !0)
        }
        function T() {
            C && (A.hide(), C = !1, a(document).unbind("mousedown", U))
        }
        function U(b) {
            if (A) {
                var c = b.target;
                if (c == d[0] || c == A[0] || a.contains(A[0], c)) return
            }
            W()
        }
        function V() {
            a(document).mousedown(U), D = !0, l || N()
        }
        function W() {
            T(), D = !1, d.removeClass("loadingAutoComplete"), t && t()
        }
        function X(b, c) {
            E = !1;
            var e = !1;
            m ? e = m(b, c) : d.val(a(b).text()), e || T()
        }
        function Y() {
            z = {}
        }
        var d = a(b),
            e = c.dataHandler || c.handlerUrl;
        if (!d.length || d[0].type !== "text" && d[0].type !== "textarea" && !d.hasClass("contentEditable") || !c || !c.data && !e) return null;
        var f = c.data,
            g = c.template || "<% locals.forEach(function(item) { %><li> <% = item.text  %> </li><% }) %>",
            h = c.minLength || 2,
            i = c.interval || 300,
            j = c.autocomplete === undefined ? !0 : c.autocomplete,
            k = c.fitToElement,
            l = c.noListOnFocus,
            m = c.onSelectItem,
            n = c.onSelectionModified,
            o = c.positionEl || d,
            p = c.customClass,
            q = c.requestData || {}, r = c.onGetDataSuccessfully,
            s = c.onSelectionCleared,
            t = c.onBlur,
            u = c.onType,
            v = c.allowClickDefault,
            w = c.sessionRequired,
            x, y, z = {}, A, B = -1,
            C, D, E, F = "",
            G = c.noResultsMessage || "No results found.",
            H;
        return d.keydown(I).keydown(J).keyup(function (a) {
            a.which === 27 && C && (a.stopPropagation(), T())
        }).focus(V).bind("paste", K).attr("autocomplete", "off"), {
            showList: function () {
                D = !0, A || N(!0), S()
            },
            clearCache: Y,
            setNoListOnFocus: function (a) {
                l = a
            },
            blur: W,
            isVisible: C,
            hideList: T,
            setPositionEl: function (a) {
                o = a
            }
        }
    };
    Myspace.AutoComplete = b
})(jQuery);
var Myspace = Myspace || {};
(function (a) {
    function j() {
        c && c.endTour(), h && (comm.send("location.href", {
            url: h
        }), h = "")
    }
    function k(a) {
        var b = context.homeTraySetting;
        if (b) {
            var c = b.homeTraySettingVersion;
            if (c > -1) {
                var d, e;
                a.type == "welcomeTray" ? (d = b.welcomePanelTrayKey, e = !0) : a.type == "featuredArtists" && (d = b.featuredContentKey, e = b.newFeaturedContentId), d && e && l(c, d, e)
            }
        }
    }
    function l(b, c, d) {
        if (!b) return;
        var e = a.ajax({
            url: "/ajax/profile/tourSetting/update",
            data: {
                homeTraySettingVersion: b,
                settingName: c,
                settingValue: d
            },
            type: "POST",
            dataType: "json",
            success: function (a) {
                a && a.success && context.homeTraySetting && (context.homeTraySetting.homeTraySettingVersion = a.homeTraySettingVersion)
            },
            error: function () {
                console.log("error while updating tour setting")
            }
        });
        e.done(function (a) {})
    }
    function m() {
        function b() {
            n(), comm.send("location.href", {
                url: "/tour",
                loadState: function (a, b, c) {
                    return !1
                }
            })
        }
        i ? (g = null, f && (f.show(), b())) : (g = a.ajax({
            url: "/ajax/touroptions",
            type: "POST"
        }), g.done(function (c) {
            i = c && a(c), i && (a("body").append(i), q(), f = new Myspace.Dialog(i), f.show(), b())
        }))
    }
    function n() {
        h = location.pathname, context.beaconData.pf = "touroverlay", comm.send("beacon", context.beaconData), _gaq.push(["_trackPageview", location.origin + "/tour"])
    }
    function o() {
        g = a.ajax({
            url: "/ajax/resettouroptions",
            type: "POST"
        }), g.done(function (a) {
            a.success ? alert("Successfully Reset Site Tour Setting") : alert("Error occurred. Please try later.")
        })
    }
    function p() {
        d.hasClass("dropZone") && (d.removeClass("dropZone"), comm.send("drawer.panel", "queue"))
    }
    function q() {
        a("#siteTourTemplate a, #siteTourTemplate img").click(function () {
            var b = a(this).data("tour-page-url"),
                c = a(this).data("tour-type");
            b && c && (comm.send("track", new Tracking("SiteTour", "Invoke", c)), comm.send("location.href", b), comm.listen("spaceway.page.complete", function () {
                return comm.send("tour.start", c), !0
            }, !0))
        })
    }
    var b = [],
        c, d = a("body"),
        e = a(window),
        f, g, h = "",
        i;
    c = Myspace.siteTour = function () {
        function n(e) {
            q();
            if (e > -1) {
                l = e;
                var h = m.tourItems,
                    i = m.tourLength,
                    j = e + 1,
                    k = h[e],
                    n, p = k.tourItemId;
                if (p && p.length > 0) {
                    n = a("[data-tour-id='" + k.tourItemId + "']");
                    if (!n) return;
                    k.showConnectBtn && d.addClass("connectSiteTour")
                }
                c.append(o(k.content, j, i)), c.hide(), m.containerClass && b.addClass(m.containerClass), k.bracket && (b.append(f), c.append(g)), b.append(c), d.append(b), k.overlayCss && b.css(k.overlayCss), r(k, n)
            }
        }
        function o(a, b, c) {
            var d, e, f;
            return f = a.callback ? "data-callback='" + a.callback + "'" : "", d = a.callbackText ? a.callbackText : a.lastItem ? "Close" : "Next", e = "<div class='tour_header'><button class='x_14 noStyle'></button>", c > 1 && (e += "<div class='info'>" + b + " OF " + c + "</div>"), a.header.length > 0 && (e += "<div class='title'>" + a.header + "</div>"), e += "<div class='content'>" + a.body + "</div>" + "</div>" + "<div class='tour_footer'><button class='tourhomeicon tourhome noStyle'></button>", e += "<button data-index='" + a.nextId + "' class='tour-next-button'  " + f + ">" + d + "</button>", a.prevId > -1 && (e += "<button data-index='" + a.prevId + "' class='primary'>Back</button>"), e += "</div>", e
        }
        function q() {
            var f = a(i);
            if (f) {
                var g = a(j),
                    l = a(h);
                g.removeClass("tour-bracket-bottom tour-bracket-left tour-bracket-right tour-bracket-top").attr("style", ""), l.removeClass(" tour-arrow-top tour-arrow-bottom tour-arrow-right tour-arrow-left").attr("style", ""), c.html(""), b.attr("style", ""), g.remove(), f.remove(), a(k).remove()
            }
            e.unbind("resize.sitetour"), d.removeClass("connectSiteTour")
        }
        function r(b, d) {
            var f = 0,
                h = 0,
                k, m, o, p, q, r, u, v = a(i),
                w = a(j),
                x = a.extend({}, b.content),
                y = x.scrollTo,
                z = b.bracket && a.extend({}, b.bracket),
                A = 0,
                B = 0;
            y && s(y), k = d && d.outerHeight(), m = d && d.outerWidth(), r = v.height(), u = v.width();
            if (k && m) {
                var C = d.offset();
                A = f = C.left, B = h = C.top, b.overrideCss && (x.css = null);
                if (!b.arrow) {
                    var D = u - m,
                        E = r - k;
                    D > 0 && (A = f - D / 2), E > 0 && (B = h - E / 2)
                }
            } else b.bracket && !b.bracket.css && (z = null);
            c.css({
                left: A,
                top: B
            });
            switch (x.direction) {
                case "top":
                    o = {
                        left: A,
                        top: h - r - 20
                    };
                    break;
                case "bottom":
                    o = {
                        left: A,
                        top: h + k + 25
                    };
                    break;
                case "left":
                    o = {
                        left: f - u - 30,
                        top: B
                    };
                    break;
                case "right":
                    o = {
                        left: f + m + 30,
                        top: B
                    }
            }
            x.css ? o = a.extend({
                opacity: 1
            }, o, x.css) : o = a.extend({
                opacity: 1
            }, {}, o);
            if (o.left + u > a(window).width()) {
                var D = o.left + u - a(window).width();
                o.left = o.left - D - 10
            }
            if (o.top + r > a(window).height()) {
                var E = o.top + r - a(window).height();
                o.top = o.top - E - 10
            }
            c.css(o);
            if (z) {
                var F, G, H, I = "tour-arrow-" + x.direction;
                q = "tour-bracket-" + z.direction;
                switch (z.direction) {
                    case "top":
                        G = h + k + 10, p = {
                            left: f - 10,
                            top: G,
                            width: m + 10,
                            height: 10
                        }, F = {
                            top: "-=10"
                        };
                        break;
                    case "bottom":
                        G = h - 20, p = {
                            left: f - 10,
                            top: G,
                            width: m + 10,
                            height: 10
                        }, F = {
                            top: "+=10"
                        };
                        break;
                    case "left":
                        H = f + m + 10, p = {
                            left: H,
                            top: h - 10,
                            height: k + 10,
                            width: 10
                        }, F = {
                            left: "-=10"
                        };
                        break;
                    case "right":
                        H = f - 20, p = {
                            left: H,
                            top: h - 10,
                            height: k + 10,
                            width: 10
                        }, F = {
                            left: "+=10"
                        }
                }
                z.css && (p = a.extend({}, p, z.css)), w.removeClass("tour-bracket-up tour-bracket-down tour-bracket-left tour-bracket-right").addClass(q).css(p), z.anitmation && w.animate(F, 500), g.addClass(I);
                if (b.arrow) {
                    var J = p = a.extend({}, {}, b.arrow);
                    g.css(J)
                }
            }
            t(), c.fadeIn("slow"), e.unbind("resize.sitetour").bind("resize.sitetour", function () {
                n(l)
            })
        }
        function s(c) {
            var d = c.direction || "down";
            if (d && d == "left") {
                var e = a("#" + c.id);
                e && e.scrollLeft(c.move)
            } else d && d == "down" && (window.scroll(0, c.move), b.height(a(window).scrollTop() + a(window).height() - 76))
        }
        function t() {
            a("button.x_14", a(i)).click(function (a) {
                q(), d.hasClass("queueOpen") && comm.send("drawer.forceOpen", !1)
            }), a("div.tour_footer > button", a(i)).click(function (b) {
                var c = a(this),
                    e = c.hasClass("tourhomeicon"),
                    f = c.data("callback") || "",
                    g = c.data("index");
                e ? (q(), p(), d.hasClass("queueOpen") && comm.send("drawer.forceOpen", !1), comm.send("track", new Tracking("TourPopupFooter", "Invoke", "Tour")), comm.send("tour.dialogbox")) : f.length > 0 ? (q(), comm.send("tour.button", {
                    element: f,
                    nextItemIndex: g
                })) : (p(), n(g))
            })
        }
        var b = a("<div class='tour_container'>"),
            c = a("<div id='tour_dialog'>"),
            f = a("<div class='tour_bracket'>"),
            g = a("<div class='tourArrow'>"),
            h = "div.tourArrow",
            i = "#tour_dialog",
            j = "div.tour_bracket",
            k = "div.tour_container",
            l = 0,
            m, u = function () {
                m && n(0)
            }, v = function (b) {
                m = a.extend({}, {}, b), u(0)
            };
        return {
            init: v,
            startTour: u,
            showNextItem: n,
            endTour: q
        }
    }(), comm.listen("tour.button", function (a) {
        var b = context.toursetting && context.toursetting.tourSettingVersion,
            e;
        a.element == "searchtour" ? (comm.send("search.overlay", {
            searchtour: 1
        }), comm.send("tour.start", "search")) : a.element == "editprofile" ? (comm.send("location.href", "/editprofile"), comm.listen("spaceway.page.complete", function () {
            return comm.send("tour.start", "profileedit"), !0
        }, !0)) : a.element == "openqueue" ? (comm.send("drawer.forceOpen", !0), setTimeout(function () {
            c.showNextItem(a.nextItemIndex)
        }, 500), e = !0) : a.element == "opendragmode" ? (comm.send("drawer.panel", "mixes"), d.addClass("dropZone"), setTimeout(function () {
            c.showNextItem(a.nextItemIndex)
        }, 500), e = !0) : a.element == "closedragmode" && (p(), d.hasClass("queueOpen") && comm.send("drawer.forceOpen", !1)), e == 1 && comm.listen("drawer.closed", function () {
            return p(), j(), !0
        }, !0)
    }, !0), comm.listen("tour.start", function (d) {
        var e = c,
            f = b[d];
        if (!f) {
            var g = a.ajax({
                url: "/ajax/getpagetourcontent/" + d,
                type: "POST"
            });
            g.done(function (a) {
                a && a.success && (f = a.content, b[d] = f, e && f && e.init(f))
            })
        } else e && f && e.init(f)
    }, !0), comm.listen("update.welcome.tour.setting", function () {
        return k({
            type: "welcomeTray"
        }), !0
    }, !0), comm.listen("update.featured.artists.setting", function (a) {
        return k({
            type: "featuredArtists"
        }), !0
    }, !0), comm.listen("end.search.tour", function () {
        return j(), !0
    }, !0), comm.listen("dialog.hiding", j, !0), comm.listen("dialog.showing", j, !0), comm.listen("spaceway.page.loading", j, !0), comm.listen("tour.dialogbox", m, !0), comm.listen("tour.setting.reset", o, !0), comm.listen("load.tour.page", q, !0), q()
})(jQuery);
var Myspace = Myspace || {};
(function (a) {
    Myspace.AutocompleteSearchV1 = function (b, c) {
        function r() {
            q = undefined
        }
        function s(a) {
            a.which === 13 && (e && d.abort(), f.reset())
        }
        function t(a) {
            var b = a.which,
                c = 27,
                g = u();
            if ([13, 37, 38, 39, 40].indexOf(b) !== -1) return !1;
            b === c ? (f.stop(), d = null, j()) : g.length === 0 ? (r(), e && d.abort(), f.stop(), p = "", k()) : (o(), f.reset())
        }
        function u() {
            return a.trim(b.val())
        }
        function v(b) {
            try {
                var c = new Date;
                c.getMonth() === 3 && c.getDate() === 1 && b && b.toLowerCase() === "april fools" && a("html").toggleClass("aprilFools")
            } catch (d) {}
        }
        function w() {
            var a = u();
            a.length >= g && (a.substr(0, g) !== p.substr(0, g) && r(), a !== p && (v(a), p = a, x(encodeURIComponent(a))))
        }
        function x(c) {
            e && d.abort(), e = !0, l(d), d = a.ajax({
                type: "POST",
                url: h + c + "&limit=" + i,
                data: {
                    searchType: b.data("search-type") || "all",
                    ssid: q
                },
                success: function (a, b, c) {
                    e = !1;
                    var d = c.getResponseHeader("X-SearchSessionId");
                    d && (q = d), m(a)
                },
                error: function (a) {
                    e = !1, n(a)
                }
            })
        }
        function y() {
            return q
        }
        var d, e = !1,
            f = new Myspace.ResetTimer(w, context.searchOverlay.delay),
            g = context.searchOverlay.minimumQueryLength,
            h = c.url || "/ajax/search/autocomplete/?q=",
            i = c.limit || 2,
            j = c.onHide,
            k = c.onClear || a.noop,
            l = c.onLoading || a.noop,
            m = c.onSuccess || a.noop,
            n = c.onError || a.noop,
            o = c.onReset || a.noop,
            p = "",
            q;
        return context.searchOverlay.enterKeySubmits ? b.keydown(s) : b.keyup(t), b.data("ssid") && (q = b.data("ssid")), {
            getSearchSessionId: y
        }
    }
})(jQuery);
(function (a) {
    function q(a) {
        if (a.which === 13) return !1
    }
    function r(c) {
        return c && (g = c.searchtour), b || (b = new Myspace.Dialog(a("#searchDialog"), {
            centerDialog: !1
        })), b.toggle(), b.isClosed() || (d.select(), i = window.location.href, j = context.beaconData.pf, context.beaconData.pf = "searchoverlay", comm.send("beacon", context.beaconData), document.body.style.overflow = "hidden", A()), !1
    }
    function s() {
        var a = d.val();
        if (a !== "") {
            var b = new Tracking("searchoverlay", "Query", a.toLowerCase());
            comm.send("track", b)
        }
        document.body.style.overflow = "auto", context.beaconData.pf = j, B(), o = null, l = 0
    }
    function t() {
        B(), e.removeClass("loading white")
    }
    function u() {
        B(), e.removeClass("loading white"), e.html(""), f.hide()
    }
    function v(a) {
        B(), g && (comm.send("end.search.tour"), g = !1), e.addClass("loading white"), e.html(""), f.hide()
    }
    function w() {}
    function x(a) {
        e.removeClass("loading white"), a.hasRecords ? (e.html(a.markup), f.hide(), z(), comm.send("page.changed", e)) : (e.html(""), f.show())
    }
    function y(a) {
        e.removeClass("loading white")
    }
    function z() {
        p = e.find(".shortResults"), n = p.first().children("li"), p.click(function (b) {
            var c = a(b.target);
            if (b.target.nodeName != "A" && b.target.nodeName != "BUTTON" && !c.hasClass("connectButton") && !c.parent().hasClass("connectButton")) {
                var d = c.closest("li").find(".mainLink").attr("href");
                return comm.send("location.href", d), !1
            }
        }), l = 0, A()
    }
    function A() {
        d.unbind("keydown", q), k.keydown(C)
    }
    function B() {
        d.keydown(q), k.unbind("keydown", C)
    }
    function C(a) {
        var b = a.which,
            c, e, f;
        if (b === 40) a.preventDefault(), o ? (o.removeClass("selected"), c = o.next(), c.length > 0 ? o = c.addClass("selected") : o = n.eq(0).addClass("selected")) : (n = p.first().children("li"), o = n.eq(0).addClass("selected"), l = 0, d.blur());
        else if (b === 38) {
            if (!o) return;
            a.preventDefault(), o.removeClass("selected"), c = o.prev(), c.length > 0 ? o = c.addClass("selected") : (o = null, l = 0, d.focus())
        } else if (b === 37 && o) a.preventDefault(), e = n.index(o), m = l, l--, l < 0 && (l = p.length - 1), f = p.eq(l), f.length ? (n = f.children("li"), c = f.children("li").eq(e), o.removeClass("selected"), c.length || (c = f.children("li").last()), o = c.addClass("selected")) : l = m;
        else if (b === 39 && o) a.preventDefault(), e = n.index(o), m = l, l++, l > p.length - 1 && (l = 0), f = p.eq(l), f.length ? (n = f.children("li"), c = f.children("li").eq(e), o.removeClass("selected"), c.length || (c = f.children("li").last()), o = c.addClass("selected")) : l = m;
        else if (b === 13) return !o && a.target.id == "q" ? !1 : (d.blur(), comm.send("location.href", o.find(".mainLink").attr("href")), !1)
    }
    var b, c = a("#searchDialog"),
        d = a("#q"),
        e = a("#searchResults"),
        f = a("#noResults"),
        g, h = {}, i, j, k = a(window),
        l = 0,
        m, n, o, p;
    comm.listen("search.overlay", function (a) {
        r(a)
    }, !0), comm.listen("dialog.showing", function (a) {
        a.attr("id") === "superpostDialog" && b && b.hide()
    }, !0), comm.listen("dialog.hiding", function (a) {
        a.attr("id") === "searchDialog" && s()
    }, !0), context.features.isSearchEnabled && a("#search").click(function (a) {
        a.preventDefault(), r()
    }), c.click(function (b) {
        var c = a(b.target);
        b.target.tagName != "INPUT" && c.closest(".shortResults").length == 0 && r()
    }), d.click(function (a) {
        o && (o.removeClass("selected"), o = null, l = 0)
    }), d.keydown(q), h.onHide = t, h.onLoading = v, h.onReset = w, h.onSuccess = x, h.onError = y, h.onClear = u, h.limit = 10;
    var D = new Myspace.AutocompleteSearchV1(d, h)
})(jQuery);
(function (a) {
    function f(b) {
        var c = a("#wrap").find("> .horizontalContent > div"),
            d = c.scrollLeft();
        c.scrollLeft(d + b)
    }
    function g(a) {
        return a >= 48 && a <= 57 || a >= 65 && a <= 90 || a >= 97 && a <= 122
    }
    var b = !1,
        c = /chrome/.test(navigator.userAgent.toLowerCase()),
        d = a("body"),
        e = a(window);
    d.bind("keydown", function (d) {
        var e = d.which;
        if (e === 27) a("#q").blur(), d.preventDefault();
        else {
            if ([17, 224, 91, 93].indexOf(e) > -1) return b = !0, !0;
            c && g(e) && (b = !1)
        }
    }), d.bind("keyup", function (a) {
        b && [17, 224, 91, 93].indexOf(a.which) > -1 && (b = !1), a.which === 27 ? comm.send("dialog.isOpen", function (a) {
            comm.send("page.esc", {
                isDialogOpen: a
            })
        }) : a.which === 33 ? f(-e.width()) : a.which === 34 && f(e.width())
    }), context.features.isSearchEnabled && d.bind("keypress", function (d) {
        var e = d.target,
            f = d.which,
            h = e.tagName;
        return h === "INPUT" || h === "TEXTAREA" || e.contentEditable === "true" || b || d.ctrlKey || d.altKey ? (c || (b = !1), !0) : g(f) ? (comm.send("search.overlay"), a("#q").val(String.fromCharCode(f)).focus(), !1) : !0
    })
})(jQuery);
(function (a) {
    Myspace.HtmlUploader = function (b, c, d) {
        function o() {
            g.click(function () {
                comm.send("upload.browseOpen")
            }), g.change(function (a) {
                comm.send("upload.browseClose"), p(a)
            }), f.upload && (h.bind("dragstart", d.html.dragStartHandler), h.bind("dragover", function (b) {
                return b.preventDefault && b.preventDefault(), !1
            }), h.bind("dragover", d.html.dragOverHandler), h.bind("dragenter", d.html.dragEnterHandler), h.bind("dragleave", d.html.dragLeaveHandler), h.bind("drop", function (a) {
                d.html.dropHandler && d.html.dropHandler(), p(a)
            }), d.html.drag_n_drop_Supported_handler && d.html.drag_n_drop_Supported_handler()), d.html.html_uploader_loaded && d.html.html_uploader_loaded()
        }
        function p(a) {
            d.html.dragLeaveHandler && d.html.dragLeaveHandler(a);
            var b = a.target.files || a.originalEvent.dataTransfer.files,
                c, f, h = i.length;
            if (d.CLEAR_QUEUE_ON_FILE_SELECT) for (f = 0; f < h - 1; f++) i[f] = null;
            for (f = 0; c = b[f]; f++) v(c, h, f), h++;
            d.FILES_SELECTED_HANDLER && d.FILES_SELECTED_HANDLER(b.length, e.files_queued, e.queue_errors, e.files_queued), g.val("")
        }
        function q(a, b, c) {
            d.UPLOAD_BEGIN_HANDLER && d.UPLOAD_BEGIN_HANDLER(b, c)
        }
        function r(a, b, c) {
            d.UPLOAD_PROGRESS_HANDLER && d.UPLOAD_PROGRESS_HANDLER(b, c, a.loaded)
        }
        function s(b, c, f) {
            var g = a.parseJSON(b.target.responseText)[0];
            g.success ? (e.successful_uploads++, e.files_queued--, i[f] = null, comm.send("track", new Tracking("upload", "Success", n)), d.UPLOAD_COMPLETE_HANDLER && d.UPLOAD_COMPLETE_HANDLER(c, f, g), d.UPLOAD_PROGRESS_HANDLER && d.UPLOAD_PROGRESS_HANDLER(c, f, g.size)) : t(b, c, f, g.error), x()
        }
        function t(a, b, c, f) {
            e.upload_errors++, e.files_queued--, i[c] = null, d.UPLOAD_ERROR_HANDLER && d.UPLOAD_ERROR_HANDLER(b, c, {
                errorCode: f,
                errorMessage: m.GetErrorMessage(b, m.MapServerError(f), n)
            }), x()
        }
        function u(a, b, c) {
            e.upload_canceled++, e.files_queued--, i[c] = null;
            if (l) {
                l = !1;
                return
            }
            k && (k = !1, x()), d.UPLOAD_CANCEL_HANDLER && d.UPLOAD_CANCEL_HANDLER(b, c, {
                errorCode: m.ERROR_CODES.FILE_CANCELLED,
                errorMessage: m.GetErrorMessage(b, m.ERROR_CODES.FILE_CANCELLED, n)
            })
        }
        function v(a, b, c) {
            var f = m.GetMaxFileSize(n);
            d.MAX_FILE_COUNT > -1 && c > d.MAX_FILE_COUNT - 1 ? (e.queue_errors++, i.push(null), d.FILE_PROCESSED_ERROR_HANDLER && d.FILE_PROCESSED_ERROR_HANDLER(a, b, {
                errorCode: m.ERROR_CODES.MAX_FILE_COUNT_EXCEEDED,
                errorMessage: m.GetErrorMessage(a, m.ERROR_CODES.MAX_FILE_COUNT_EXCEEDED, n)
            })) : a.size > f ? (e.queue_errors++, i.push(null), d.FILE_PROCESSED_ERROR_HANDLER && d.FILE_PROCESSED_ERROR_HANDLER(a, b, {
                errorCode: m.ERROR_CODES.MAX_FILE_SIZE_EXCEEDED,
                errorMessage: m.GetErrorMessage(a, m.ERROR_CODES.MAX_FILE_SIZE_EXCEEDED, n)
            })) : m.IsAcceptedFileType(n, a) ? y(a, b) : (e.queue_errors++, i.push(null), d.FILE_PROCESSED_ERROR_HANDLER && d.FILE_PROCESSED_ERROR_HANDLER(a, b, {
                errorCode: m.ERROR_CODES.INVALID_FILE_TYPE,
                errorMessage: m.GetErrorMessage(a, m.ERROR_CODES.INVALID_FILE_TYPE, n)
            }))
        }
        function w() {
            var a, b = null;
            for (a = 0; a < i.length; a++) if (i[a] != null) {
                    b = i[a], j = a;
                    break
                }
            d.UPLOAD_BEGIN_HANDLER && d.UPLOAD_BEGIN_HANDLER(b, j), f = new XMLHttpRequest;
            var c = new FormData;
            for (var e in d.POST_PARAMS) c.append(e, d.POST_PARAMS[e]);
            m.PreProcess(n, b, function (a) {
                c.append("file", a), c.append("ui", z()), f.upload && f.upload.addEventListener("progress", function (a) {
                    r(a, b, j)
                }, !1), f.addEventListener("error", function (a) {
                    t(a, b, j)
                }, !1), f.addEventListener("abort", function (a) {
                    u(a, b, j)
                }, !1), f.addEventListener("load", function (a) {
                    s(a, b, j)
                }, !1), f.open("POST", m.GetUploadEndpoint(d.MEDIA_TYPE)), f.send(c)
            })
        }
        function x() {
            e.files_queued > 0 ? (w(), e.in_progress = !0) : e.in_progress = !1
        }
        function y(a, b) {
            e.files_queued++, i.push(a), d.FILE_PROCESSED_SUCCESS_HANDLER && d.FILE_PROCESSED_SUCCESS_HANDLER(a, b)
        }
        function z() {
            var a = "";
            for (var b = 0; b < 32; b++) a += Math.floor(Math.random() * 16).toString(16);
            return a
        }
        var e = {
            in_progress: !1,
            files_queued: 0,
            successful_uploads: 0,
            upload_errors: 0,
            upload_canceled: 0,
            queue_errors: 0
        }, f = new XMLHttpRequest,
            g = b,
            h = c,
            i = [],
            j = 0,
            k = !1,
            l = !1,
            m = Myspace.Upload,
            n = d.MEDIA_TYPE == m.MEDIA_TYPES.TEMP ? d.POST_PARAMS.type : d.MEDIA_TYPE;
        this.CancelUpload = function (a) {
            i[a] = null;
            if (a < j) return;
            a == j && f && (k = !0, f.abort()), a > j && (e.upload_canceled++, e.files_queued--, d.UPLOAD_CANCEL_HANDLER && d.UPLOAD_CANCEL_HANDLER(i[a], a, m.ERROR_CODES.FILE_CANCELLED))
        }, this.StopUpload = function () {
            l = !0, f.abort()
        }, this.StartUpload = function () {
            x()
        }, this.GetStats = function () {
            return e
        }, o()
    }
})(jQuery);
(function (a) {
    Myspace.LiteUploader = function (b) {
        function f() {
            a.extend(!0, d, b);
            var f = a(d.html.filesInput),
                g = a(d.html.dragDropArea);
            if (context.iOSUploadSupported === !1) {
                var h = a("<input type='button' style='opacity:0'/>");
                h.attr("id", f.attr("id")).attr("class", f.attr("class")).width(f.width()).click(function (b) {
                    b.preventDefault(), e || (e = new Myspace.Dialog(a("#iOSUploadSupport"))), e.show()
                }), f.after(h).remove()
            }
            c = new Myspace.HtmlUploader(f, g, d)
        }
        var c = null,
            d = {
                MAX_FILE_COUNT: 1,
                MEDIA_TYPE: null,
                CLEAR_QUEUE_ON_FILE_SELECT: !0,
                POST_PARAMS: {
                    utoken: context.hashMashter
                },
                FILES_SELECTED_HANDLER: null,
                FILE_PROCESSED_SUCCESS_HANDLER: null,
                FILE_PROCESSED_ERROR_HANDLER: null,
                UPLOAD_BEGIN_HANDLER: null,
                UPLOAD_PROGRESS_HANDLER: null,
                UPLOAD_ERROR_HANDLER: null,
                UPLOAD_CANCEL_HANDLER: null,
                UPLOAD_COMPLETE_HANDLER: null,
                html: {
                    filesInput: "",
                    dragDropArea: "",
                    dragStartHandler: null,
                    dragOverHandler: null,
                    dragEnterHandler: null,
                    dragLeaveHandler: null,
                    drag_n_drop_NotSupported_handler: null
                }
            }, e;
        this.CancelUpload = function (a) {
            c.CancelUpload(a)
        }, this.StopUpload = function () {
            c.StopUpload()
        }, this.StartUpload = function () {
            c.StartUpload()
        }, this.GetStats = function () {
            return c.GetStats()
        }, this.SetPostParams = function (b) {
            a.extend(!0, d.POST_PARAMS, b)
        }, f()
    }
})(jQuery);
(function (a) {
    Myspace.Uploader = function (b) {
        function f() {
            a.extend(!0, d, b);
            var f = a(d.html.filesInput),
                g = a(d.html.dragDropArea);
            if (context.iOSUploadSupported === !1) {
                var h = a("<input type='button' style='opacity:0'/>");
                h.attr("id", f.attr("id")).attr("class", f.attr("class")).width(f.width()).click(function (b) {
                    b.preventDefault(), e || (e = new Myspace.Dialog(a("#iOSUploadSupport"))), e.show()
                }), f.after(h).remove()
            }
            c = new Myspace.HtmlUploader(f, g, d)
        }
        var c = null,
            d = {
                MAX_FILE_COUNT: -1,
                MEDIA_TYPE: null,
                POST_PARAMS: {
                    utoken: context.hashMashter
                },
                FILES_SELECTED_HANDLER: null,
                FILE_PROCESSED_SUCCESS_HANDLER: null,
                FILE_PROCESSED_ERROR_HANDLER: null,
                UPLOAD_BEGIN_HANDLER: null,
                UPLOAD_PROGRESS_HANDLER: null,
                UPLOAD_ERROR_HANDLER: null,
                UPLOAD_CANCEL_HANDLER: null,
                UPLOAD_COMPLETE_HANDLER: null,
                html: {
                    filesInput: "",
                    dragDropArea: "",
                    dragStartHandler: null,
                    dragOverHandler: null,
                    dragEnterHandler: null,
                    dragLeaveHandler: null,
                    dropHandler: null,
                    drag_n_drop_Supported_handler: null,
                    html_uploader_loaded: null
                }
            }, e;
        this.CancelUpload = function (a) {
            c.CancelUpload(a)
        }, this.StopUpload = function () {
            c.StopUpload()
        }, this.StartUpload = function () {
            c.StartUpload()
        }, this.GetStats = function () {
            return c.GetStats()
        }, this.SetPostParams = function (b) {
            a.extend(!0, d.POST_PARAMS, b)
        }, this.SetOptions = function (b) {
            a.extend(!0, d, b)
        }, f()
    }
})(jQuery);
(function (a) {
    var b = {
        ArrayBuffer: typeof ArrayBuffer != "undefined",
        DataView: typeof DataView != "undefined" && ("getFloat64" in DataView.prototype || "getFloat64" in new DataView(new ArrayBuffer(1))),
        NodeBuffer: typeof Buffer != "undefined" && "readInt16LE" in Buffer.prototype
    }, c = {
            Int8: 1,
            Int16: 2,
            Int32: 4,
            Uint8: 1,
            Uint16: 2,
            Uint32: 4,
            Float32: 4,
            Float64: 8
        }, d = {
            Int8: "Int8",
            Int16: "Int16",
            Int32: "Int32",
            Uint8: "UInt8",
            Uint16: "UInt16",
            Uint32: "UInt32",
            Float32: "Float",
            Float64: "Double"
        }, e = function (f, g, h, i) {
            if (!(this instanceof e)) throw new Error("jDataView constructor may not be called as a function");
            this.buffer = f;
            if (!(b.NodeBuffer && f instanceof Buffer) && !(b.ArrayBuffer && f instanceof ArrayBuffer) && typeof f != "string") throw new TypeError("jDataView buffer has an incompatible type");
            this._isArrayBuffer = b.ArrayBuffer && f instanceof ArrayBuffer, this._isDataView = b.DataView && this._isArrayBuffer, this._isNodeBuffer = b.NodeBuffer && f instanceof Buffer, this._littleEndian = i === undefined ? !1 : i;
            var j = this._isArrayBuffer ? f.byteLength : f.length;
            g === undefined && (g = 0), this.byteOffset = g, h === undefined && (h = j - g), this.byteLength = h;
            if (!this._isDataView) {
                if (typeof g != "number") throw new TypeError("jDataView byteOffset is not a number");
                if (typeof h != "number") throw new TypeError("jDataView byteLength is not a number");
                if (g < 0) throw new Error("jDataView byteOffset is negative");
                if (h < 0) throw new Error("jDataView byteLength is negative")
            }
            this._isDataView && (this._view = new DataView(f, g, h), this._start = 0), this._start = g;
            if (g + h > j) throw new Error("jDataView (byteOffset + byteLength) value is out of bounds");
            this._offset = 0;
            if (this._isDataView) for (var k in c) {
                    if (!c.hasOwnProperty(k)) continue;
                    (function (a, b) {
                        var d = c[a];
                        b["get" + a] = function (c, e) {
                            return e === undefined && (e = b._littleEndian), c === undefined && (c = b._offset), b._offset = c + d, b._view["get" + a](c, e)
                        }
                    })(k, this)
            } else if (this._isNodeBuffer && b.NodeBuffer) for (var k in c) {
                    if (!c.hasOwnProperty(k)) continue;
                    var l;
                    k === "Int8" || k === "Uint8" ? l = "read" + d[k] : i ? l = "read" + d[k] + "LE" : l = "read" + d[k] + "BE",
                    function (a, b, d) {
                        var e = c[a];
                        b["get" + a] = function (a, c) {
                            return c === undefined && (c = b._littleEndian), a === undefined && (a = b._offset), b._offset = a + e, b.buffer[d](b._start + a)
                        }
                    }(k, this, l)
            } else for (var k in c) {
                    if (!c.hasOwnProperty(k)) continue;
                    (function (b, d) {
                        var e = c[b];
                        d["get" + b] = function (c, f) {
                            f === undefined && (f = d._littleEndian), c === undefined && (c = d._offset), d._offset = c + e;
                            if (d._isArrayBuffer && (d._start + c) % e === 0 && (e === 1 || f)) return (new a[b + "Array"](d.buffer, d._start + c, 1))[0];
                            if (typeof c != "number") throw new TypeError("jDataView byteOffset is not a number");
                            if (c + e > d.byteLength) throw new Error("jDataView (byteOffset + size) value is out of bounds");
                            return d["_get" + b](d._start + c, f)
                        }
                    })(k, this)
            }
        };
    b.NodeBuffer ? e.createBuffer = function () {
        var a = new Buffer(arguments.length);
        for (var b = 0; b < arguments.length; ++b) a[b] = arguments[b];
        return a
    } : b.ArrayBuffer ? e.createBuffer = function () {
        var a = new ArrayBuffer(arguments.length),
            b = new Int8Array(a);
        for (var c = 0; c < arguments.length; ++c) b[c] = arguments[c];
        return a
    } : e.createBuffer = function () {
        return String.fromCharCode.apply(null, arguments)
    }, e.prototype = {
        compatibility: b,
        getString: function (a, b) {
            var c;
            b === undefined && (b = this._offset);
            if (typeof b != "number") throw new TypeError("jDataView byteOffset is not a number");
            if (a < 0 || b + a > this.byteLength) throw new Error("jDataView length or (byteOffset+length) value is out of bounds");
            if (this._isNodeBuffer) c = this.buffer.toString("ascii", this._start + b, this._start + b + a);
            else {
                c = "";
                for (var d = 0; d < a; ++d) {
                    var e = this.getUint8(b + d);
                    c += String.fromCharCode(e > 127 ? 65533 : e)
                }
            }
            return this._offset = b + a, c
        },
        getChar: function (a) {
            return this.getString(1, a)
        },
        tell: function () {
            return this._offset
        },
        seek: function (a) {
            if (typeof a != "number") throw new TypeError("jDataView byteOffset is not a number");
            if (a < 0 || a > this.byteLength) throw new Error("jDataView byteOffset value is out of bounds");
            return this._offset = a
        },
        _endianness: function (a, b, c, d) {
            return a + (d ? c - b - 1 : b)
        },
        _getFloat64: function (a, b) {
            var c = this._getUint8(this._endianness(a, 0, 8, b)),
                d = this._getUint8(this._endianness(a, 1, 8, b)),
                e = this._getUint8(this._endianness(a, 2, 8, b)),
                f = this._getUint8(this._endianness(a, 3, 8, b)),
                g = this._getUint8(this._endianness(a, 4, 8, b)),
                h = this._getUint8(this._endianness(a, 5, 8, b)),
                i = this._getUint8(this._endianness(a, 6, 8, b)),
                j = this._getUint8(this._endianness(a, 7, 8, b)),
                k = 1 - 2 * (c >> 7),
                l = ((c << 1 & 255) << 3 | d >> 4) - (Math.pow(2, 10) - 1),
                m = (d & 15) * Math.pow(2, 48) + e * Math.pow(2, 40) + f * Math.pow(2, 32) + g * Math.pow(2, 24) + h * Math.pow(2, 16) + i * Math.pow(2, 8) + j;
            return l === 1024 ? m !== 0 ? NaN : k * Infinity : l === -1023 ? k * m * Math.pow(2, -1074) : k * (1 + m * Math.pow(2, -52)) * Math.pow(2, l)
        },
        _getFloat32: function (a, b) {
            var c = this._getUint8(this._endianness(a, 0, 4, b)),
                d = this._getUint8(this._endianness(a, 1, 4, b)),
                e = this._getUint8(this._endianness(a, 2, 4, b)),
                f = this._getUint8(this._endianness(a, 3, 4, b)),
                g = 1 - 2 * (c >> 7),
                h = (c << 1 & 255 | d >> 7) - 127,
                i = (d & 127) << 16 | e << 8 | f;
            return h === 128 ? i !== 0 ? NaN : g * Infinity : h === -127 ? g * i * Math.pow(2, -149) : g * (1 + i * Math.pow(2, -23)) * Math.pow(2, h)
        },
        _getInt32: function (a, b) {
            var c = this._getUint32(a, b);
            return c > Math.pow(2, 31) - 1 ? c - Math.pow(2, 32) : c
        },
        _getUint32: function (a, b) {
            var c = this._getUint8(this._endianness(a, 0, 4, b)),
                d = this._getUint8(this._endianness(a, 1, 4, b)),
                e = this._getUint8(this._endianness(a, 2, 4, b)),
                f = this._getUint8(this._endianness(a, 3, 4, b));
            return c * Math.pow(2, 24) + (d << 16) + (e << 8) + f
        },
        _getInt16: function (a, b) {
            var c = this._getUint16(a, b);
            return c > Math.pow(2, 15) - 1 ? c - Math.pow(2, 16) : c
        },
        _getUint16: function (a, b) {
            var c = this._getUint8(this._endianness(a, 0, 2, b)),
                d = this._getUint8(this._endianness(a, 1, 2, b));
            return (c << 8) + d
        },
        _getInt8: function (a) {
            var b = this._getUint8(a);
            return b > Math.pow(2, 7) - 1 ? b - Math.pow(2, 8) : b
        },
        _getUint8: function (a) {
            return this._isArrayBuffer ? (new Uint8Array(this.buffer, a, 1))[0] : this._isNodeBuffer ? this.buffer[a] : this.buffer.charCodeAt(a) & 255
        }
    };
    if (typeof jQuery != "undefined" && jQuery.fn.jquery >= "1.6.2") {
        var f = function (a) {
            var b;
            try {
                b = IEBinaryToArray_ByteStr(a)
            } catch (c) {
                var d = "Function IEBinaryToArray_ByteStr(Binary)\r\n	IEBinaryToArray_ByteStr = CStr(Binary)\r\nEnd Function\r\nFunction IEBinaryToArray_ByteStr_Last(Binary)\r\n	Dim lastIndex\r\n	lastIndex = LenB(Binary)\r\n	if lastIndex mod 2 Then\r\n		IEBinaryToArray_ByteStr_Last = AscB( MidB( Binary, lastIndex, 1 ) )\r\n	Else\r\n		IEBinaryToArray_ByteStr_Last = -1\r\n	End If\r\nEnd Function\r\n";
                window.execScript(d, "vbscript"), b = IEBinaryToArray_ByteStr(a)
            }
            var e = IEBinaryToArray_ByteStr_Last(a),
                f = "",
                g = 0,
                h = b.length % 8,
                i;
            while (g < h) i = b.charCodeAt(g++), f += String.fromCharCode(i & 255, i >> 8);
            h = b.length;
            while (g < h) f += String.fromCharCode((i = b.charCodeAt(g++), i & 255), i >> 8, (i = b.charCodeAt(g++), i & 255), i >> 8, (i = b.charCodeAt(g++), i & 255), i >> 8, (i = b.charCodeAt(g++), i & 255), i >> 8, (i = b.charCodeAt(g++), i & 255), i >> 8, (i = b.charCodeAt(g++), i & 255), i >> 8, (i = b.charCodeAt(g++), i & 255), i >> 8, (i = b.charCodeAt(g++), i & 255), i >> 8);
            return e > -1 && (f += String.fromCharCode(e)), f
        };
        jQuery.ajaxSetup({
            converters: {
                "* dataview": function (a) {
                    return new e(a)
                }
            },
            accepts: {
                dataview: "text/plain; charset=x-user-defined"
            },
            responseHandler: {
                dataview: function (a, b, c) {
                    "mozResponseArrayBuffer" in c ? a.text = c.mozResponseArrayBuffer : "responseType" in c && c.responseType === "arraybuffer" && c.response ? a.text = c.response : "responseBody" in c ? a.text = f(c.responseBody) : a.text = c.responseText
                }
            }
        }), jQuery.ajaxPrefilter("dataview", function (a, b, c) {
            jQuery.support.ajaxResponseType && (a.hasOwnProperty("xhrFields") || (a.xhrFields = {}), a.xhrFields.responseType = "arraybuffer"), a.mimeType = "text/plain; charset=x-user-defined"
        })
    }
    a.jDataView = (a.module || {}).exports = e, typeof module != "undefined" && (module.exports = e)
})(this);
var JpegAPPMarkers = function () {
    function c(a, b) {
        try {
            if (!a || !b) return null;
            var c = a.split(" ");
            if (c.length != 3) return null;
            var f = d(c[0]),
                g = d(c[1]),
                h = d(c[2]),
                i = e(f + g / 60 + h / 3600) * b;
            return isNaN(i) ? null : i
        } catch (j) {
            return null
        }
    }
    function d(a) {
        var b = a.split("/");
        if (b.length == 2) {
            var c = parseFloat(b[0]),
                d = parseFloat(b[1]);
            return c / d
        }
    }
    function e(a) {
        var b = Math.pow(10, 6),
            c = Math.round(a * b) / b;
        return c
    }
    function f(a) {
        if (!a) return null;
        switch (a.toUpperCase()) {
            case "N":
            case "E":
                return 1;
            case "S":
            case "W":
                return -1
        }
    }
    function g(a, b) {
        if (b.type === 65505) {
            var c = new jDataView(j(a, b.position + 4, b.position + 4 + b.size));
            if (c.getString(4) === "Exif") return c
        }
        return
    }
    function h(a, b, c, d, e) {
        var f = d.getUint16(c, e),
            g = [];
        for (var h = 0; h < f; h++) {
            var j = d.getUint16(c + 2, e),
                k = a[j];
            if (k) {
                var l = d.getUint16(c + 4, e),
                    m = d.getUint32(c + 6, e),
                    n = d.getUint32(c + 10, e);
                g[k] = i(d, l, m, c, n + b, e)
            }
            c += 12
        }
        return g
    }
    function i(a, b, c, d, e, f) {
        var g = c > 4 ? e : d + 10;
        switch (b) {
            case 2:
                return a.getString(c - 1, g);
            case 3:
                return a.getUint16(g, f);
            case 4:
                return a.getUint32(g, f);
            case 5:
                var h, i;
                if (c === 3) {
                    var j = [];
                    for (var k = 0; k < c; k++) h = a.getUint32(e + k * 8, f), i = a.getUint32(e + 4 + k * 8, f), j.push(h + "/" + i);
                    return j.join(" ")
                }
        }
    }
    function j(a, b, c) {
        if (a.slice) try {
                return a.slice(b, c)
        } catch (d) {}
        var e = c - b,
            f = new Uint8Array(a),
            g = new ArrayBuffer(e),
            h = new Uint8Array(g);
        for (var i = 0; i < e; i++) h[i] = f[i + b];
        return h
    }
    function k(a) {
        return a >= 65505 && a <= 65519 || a === 65534
    }
    function l(a) {
        if (window.Blob) try {
                return new Blob(a, {
                    type: "image/jpeg"
                })
        } catch (b) {}
        var c = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder,
            d = new c;
        for (var e = 0; e < a.length; e++) d.append(a[e]);
        return d.getBlob("image/jpeg")
    }
    function m(a) {
        var b = {
            valid: !1,
            sosPosition: 0,
            appMarkers: [],
            markers: []
        }, c, d, e, f = new jDataView(a);
        if (f.getUint16() !== 65496) return b;
        var g = Math.min(a.byteLength, 2097152);
        while (f.tell() < g) {
            c = f.getUint16();
            switch (c) {
                case 65504:
                case 65505:
                case 65506:
                case 65507:
                case 65508:
                case 65509:
                case 65510:
                case 65511:
                case 65512:
                case 65513:
                case 65514:
                case 65515:
                case 65516:
                case 65517:
                case 65518:
                case 65519:
                case 65472:
                case 65473:
                case 65474:
                case 65475:
                case 65499:
                case 65500:
                case 65501:
                case 65502:
                case 65503:
                case 65476:
                case 65477:
                case 65478:
                case 65479:
                case 65480:
                case 65481:
                case 65482:
                case 65483:
                case 65484:
                case 65485:
                case 65486:
                case 65487:
                case 65534:
                case 65488:
                case 65489:
                case 65490:
                case 65491:
                case 65492:
                case 65493:
                case 65494:
                case 65495:
                case 65520:
                case 65521:
                case 65522:
                case 65523:
                case 65524:
                case 65525:
                case 65526:
                case 65527:
                case 65528:
                case 65529:
                case 65530:
                case 65531:
                case 65532:
                case 65533:
                case 65281:
                    d = f.getUint16(), e = f.tell() - 4;
                    var h = {
                        type: c,
                        position: e,
                        size: d
                    };
                    k(c) ? b.appMarkers.push(h) : b.markers.push(h), f.seek(f.tell() + d - 2)
            }
            if (h === 65498) {
                b.valid = !0, b.sosPosition = f.tell() - 2;
                break
            }
        }
        return b
    }
    function n(a, b, c) {
        var d = [],
            e;
        c || (c = m(a));
        var f = m(b);
        if (!c.valid || c.appMarkers.length === 0 || !f.valid) return l([b]);
        var g;
        for (var h = 0; h < f.markers.length; h++) if (f.markers[h].type === 65504) {
                g = f.markers[h], f.markers.splice(h, 1);
                break
            }
        d.push(j(b, 0, 2)), g && d.push(j(b, g.position, g.position + (g.size + 2)));
        for (var h = 0; h < c.appMarkers.length; h++) e = c.appMarkers[h], d.push(j(a, e.position, e.position + (e.size + 2)));
        for (var h = 0; h < f.markers.length; h++) e = f.markers[h], d.push(j(b, e.position, e.position + (e.size + 2)));
        return d.push(j(b, f.sosPosition, b.byteLength)), l(d)
    }
    function o(d, e) {
        var i = {
            hasExif: !1,
            copyright: null,
            artist: null,
            make: null,
            model: null,
            orientation: 0,
            hasGPSLocation: !1,
            longitude: 0,
            latitude: 0
        };
        e || (e = m(d));
        if (!e.valid || e.appMarkers.length === 0) return i;
        var j;
        for (var k = 0; k < e.appMarkers.length; k++) {
            j = g(d, e.appMarkers[k]);
            if (j) break
        }
        if (!j) return i;
        var l = j.tell() + 2,
            n = j.getUint16(j.tell() + 2) === 18761;
        if (j.getUint16(j.tell(), n) != 42 || j.getUint32(j.tell(), n) != 8) return i;
        var o = h(a, l, j.tell(), j, n);
        if (o) {
            i.hasExif = !0, i.copyright = o.Copyright ? o.Copyright : null, i.make = o.Make ? o.Make : null, i.model = o.Model ? o.Model : null, i.artist = o.Artist ? o.Artist : null, i.orientation = o.Orientation ? o.Orientation : 0;
            if (o.GPSInfoIFDPointer) {
                var p = h(b, l, o.GPSInfoIFDPointer + 6, j, n),
                    q = f(p.GPSLatitudeRef),
                    r = f(p.GPSLongitudeRef);
                if (q !== null && r !== null) {
                    var s = c(p.GPSLatitude, q),
                        t = c(p.GPSLongitude, r);
                    s !== null && t !== null && (i.hasGPSLocation = !0, i.latitude = s, i.longitude = t)
                }
            }
        }
        return i
    }
    "use strict";
    var a = {
        34853: "GPSInfoIFDPointer",
        274: "Orientation",
        271: "Make",
        272: "Model",
        315: "Artist",
        33432: "Copyright"
    }, b = {
            1: "GPSLatitudeRef",
            2: "GPSLatitude",
            3: "GPSLongitudeRef",
            4: "GPSLongitude"
        };
    return {
        getMarkers: function (a) {
            return m(a)
        },
        copyMarkers: function (a, b, c) {
            return n(a, b, c)
        },
        getExif: function (a, b) {
            return o(a, b)
        }
    }
}();
(function (a) {
    function b(a) {
        return a.name.substr(a.name.lastIndexOf(".")).toLowerCase()
    }
    function c(a, b, c) {
        var d = 1;
        a.width > b ? d = b / a.width : a.height > c && (d = c / a.height);
        var e = {};
        return e.height = Math.round(a.height * d), e.width = Math.round(a.width * d), e
    }
    function d(a) {
        var b;
        a.split(",")[0].indexOf("base64") >= 0 ? b = atob(a.split(",")[1]) : b = unescape(a.split(",")[1]);
        var c = a.split(",")[0].split(":")[1].split(";")[0],
            d = new ArrayBuffer(b.length),
            e = new Uint8Array(d);
        for (var f = 0; f < b.length; f++) e[f] = b.charCodeAt(f);
        return d
    }
    Myspace.Upload = {}, Myspace.Upload.ERROR_CODES = {
        MAX_FILE_COUNT_EXCEEDED: -100,
        MAX_FILE_SIZE_EXCEEDED: -110,
        INVALID_FILE_TYPE: -130,
        HTTP_ERROR: -200,
        MISSING_UPLOAD_URL: -210,
        IO_ERROR: -220,
        SECURITY_ERROR: -230,
        UPLOAD_LIMIT_EXCEEDED: -240,
        UPLOAD_FAILED: -250,
        SPECIFIED_FILE_ID_NOT_FOUND: -260,
        FILE_VALIDATION_FAILED: -270,
        FILE_CANCELLED: -280,
        UPLOAD_STOPPED: -290,
        NOT_LOGGED_IN: -300,
        INVALID_IMAGE: -310,
        NO_FILES: -320,
        MINIMUM_IMAGE_SIZE: -330,
        INVALID_CROP: -340,
        TIMEOUT: -350,
        MINIMUM_VIDEO_SIZE: -360,
        FILE_TOO_LARGE: -370,
        ALBUM_LIMIT: -380
    }, Myspace.Upload.MEDIA_TYPES = {
        PHOTO: "photo",
        STREAM: "stream",
        COVER: "cover",
        PROFILE: "profile",
        PLAYLIST: "playlist",
        SONG: "song",
        VIDEO: "video",
        ALBUMART: "albumart",
        SONGART: "songart",
        VIDEOTHUMBNAIL: "videothumbnail",
        TEMP: "temp"
    }, Myspace.Upload.MIN_IMAGE_DIMENSIONS = {
        PHOTO: undefined,
        STREAM: undefined,
        COVER: [1024, 768],
        PROFILE: [140, 140],
        PLAYLIST: [1024, 768],
        ALBUMART: [600, 600],
        SONGART: [600, 600],
        VIDEOTHUMBNAIL: [640, 360]
    }, Myspace.Upload.MAX_FILE_SIZES = {
        PHOTO: 20971520,
        STREAM: 20971520,
        COVER: 20971520,
        PROFILE: 20971520,
        PLAYLIST: 20971520,
        SONG: 1073741824,
        VIDEO: 4294967296,
        ALBUMART: 20971520,
        SONGART: 20971520,
        VIDEOTHUMBNAIL: 20971520,
        TEMP: 20971520
    }, Myspace.Upload.FILE_TYPES = {
        ALL: "*.*",
        PHOTO: "*.jpg;*.jpeg;*.jpe;*.png;*.gif;*.bmp;*.tif;*.tiff",
        AUDIO: "*.mp3;*.wma;*.asf;*.ogg;*.mpc;*.ape;*.wav;*.mp4;*.m4a;*.mp4a;*.au;*.snd;*.aif;*.aiff;*.ram;*.ra;*.rmvb;*.aac;*.tta;*.ac3;*.gsm;*.flac;*.flc;*.wvc;*.wv;*.amr;*.flv",
        VIDEO: "*.avi;*.asf;*.dv;*.wmv;*.mov;*.qt;*.3g2;*.3gp;*.3gp2;*.3gpp;*.gsm;*.mpg;*.mpeg;*.mp1;*.mp2;*.mp4;*.m4v;*.mp4v;*.cmp;*.divx;*.xvid;*.264;*.rm;*.rmvb;*.flv;*.mkv;*.ogm;*.h264;*.m2p"
    }, Myspace.Upload.GetErrorMessage = function (a, b, c) {
        var d = this.ERROR_CODES,
            e = "",
            f = "",
            g = "",
            h = [];
        a && c !== this.MEDIA_TYPES.SONG && c !== this.MEDIA_TYPES.VIDEO && (e = a.name.substring(a.name.length - 4, a.name.length), f = a.name.length > 15 ? a.name.substring(0, 10) + "..." + e : a.name, g = "File: " + f + " - ");
        switch (b) {
            case d.MAX_FILE_COUNT_EXCEEDED:
                g += "You have selected too many files.";
                break;
            case d.FILE_TOO_LARGE:
            case d.MAX_FILE_SIZE_EXCEEDED:
                g += "The file exceeds our maximum allowed file size limit.";
                break;
            case d.INVALID_FILE_TYPE:
                g += "The file selected is not an allowed file type.";
                break;
            case d.SPECIFIED_FILE_ID_NOT_FOUND:
                g += "The file wasn't found on your computer.";
                break;
            case d.FILE_VALIDATION_FAILED:
                g += "The file selected is either too large or is not a supported file type.";
                break;
            case d.FILE_CANCELLED:
                g += "The file upload was canceled.";
                break;
            case d.UPLOAD_STOPPED:
                g += "Upload has been stopped.";
                break;
            case d.NOT_LOGGED_IN:
                g += "In order to upload, you need to be signed in.  Please sign in and try again.";
                break;
            case d.INVALID_IMAGE:
                g += "The file selected is not a valid image.";
                break;
            case d.NO_FILES:
                g += "There are no files to upload.";
                break;
            case d.MINIMUM_IMAGE_SIZE:
                g += "The image does not meet the minimum dimension requirements.";
                break;
            case d.MINIMUM_VIDEO_SIZE:
                g += "The video does not meet the minimum dimension requirements.";
                break;
            case d.INVALID_CROP:
                g += "Saving crop of image failed.";
                break;
            case d.TIMEOUT:
                g += "The file upload timed out.  Please try again...";
                break;
            case d.ALBUM_LIMIT:
                g += "The maximum limit of images in a mix has been reached. ";
            default:
                g += "There was an error uploading.  Please try again..."
        }
        if (b == d.MAX_FILE_SIZE_EXCEEDED || b == d.FILE_TOO_LARGE) e == ".gif" ? g = g + "  Animated Gifs can not be larger than 4MB.  Non-animated Gifs can not be larger than " + this.BytesToBiggerBytes(this.GetMaxFileSize(c) + ".") : g = g + "  Files can not be larger than " + this.BytesToBiggerBytes(this.GetMaxFileSize(c));
        return b == d.INVALID_FILE_TYPE && c !== this.MEDIA_TYPES.SONG && c !== this.MEDIA_TYPES.VIDEO && (g = g + "  Files can only be of the types: " + this.GetAcceptableFileTypes(c).replace(/;/g, ", ")), b == d.MAX_FILE_COUNT_EXCEEDED && (c === this.MEDIA_TYPES.SONG ? g = "You have reached the maximum of 50 uploads. You may delete a song and try again. " : c === this.MEDIA_TYPES.VIDEO && (g = "You have reached the maximum of 20 uploads. You may delete a video and try again. ")), b == d.FILE_VALIDATION_FAILED && c !== this.MEDIA_TYPES.SONG && c !== this.MEDIA_TYPES.VIDEO && (g = g + "  Files can not be larger than " + this.BytesToBiggerBytes(this.GetMaxFileSize(c)) + " and can only be of the types: " + this.GetAcceptableFileTypes(c).replace(/;/g, ", ")), b == d.MINIMUM_IMAGE_SIZE && (h = this.GetMinimumDimensions(c), g = g + "  Image dimensions must be at least " + h[0] + "x" + h[1] + " pixels."), b == d.MINIMUM_VIDEO_SIZE && (h = this.GetMinimumDimensions(c), g = g + "  Video dimensions must be at least " + h[0] + "x" + h[1] + " pixels."), b == d.INVALID_CROP && (h = this.GetMinimumDimensions(c), g = g + "  Cropped size must be at least " + h[0] + "x" + h[1] + " pixels."), g
    }, Myspace.Upload.MapServerError = function (a) {
        var b = this.ERROR_CODES;
        switch (a) {
            case "TIMEOUT":
                return b.TIMEOUT;
            case "UNEXPECTED_ERROR":
                return b.UPLOAD_FAILED;
            case "NOT_LOGGED_IN":
                return b.NOT_LOGGED_IN;
            case "INVALID_IMAGE":
                return b.INVALID_IMAGE;
            case "INVALID_FILE_SIZE":
                return b.MAX_FILE_SIZE_EXCEEDED;
            case "NO_FILES":
                return b.NO_FILES;
            case "UNSUPPORTED_FILE_TYPE":
                return b.INVALID_FILE_TYPE;
            case "MINIMUM_IMAGE_SIZE":
                return b.MINIMUM_IMAGE_SIZE;
            case "MINIMUM_VIDEO_SIZE":
                return b.MINIMUM_VIDEO_SIZE;
            case "INVALID_CROP":
                return b.INVALID_CROP;
            case "FILE_TOO_LARGE":
                return b.FILE_TOO_LARGE;
            case "ALBUM_LIMIT":
                return b.FILE_TOO_LARGE;
            default:
                return b.UPLOAD_FAILED
        }
    }, Myspace.Upload.GetMaxFileSize = function (a) {
        var b = this.MEDIA_TYPES,
            c = this.MAX_FILE_SIZES;
        switch (a) {
            case b.PHOTO:
                return c.PHOTO;
            case b.STREAM:
                return c.STREAM;
            case b.COVER:
                return c.COVER;
            case b.PROFILE:
                return c.PROFILE;
            case b.PLAYLIST:
                return c.PLAYLIST;
            case b.SONG:
                return c.SONG;
            case b.VIDEO:
                return c.VIDEO;
            case b.ALBUMART:
                return c.ALBUMART;
            case b.SONGART:
                return c.SONGART;
            case b.VIDEOTHUMBNAIL:
                return c.VIDEOTHUMBNAIL;
            case b.TEMP:
                return c.TEMP
        }
    }, Myspace.Upload.GetAcceptableFileTypes = function (a) {
        var b = this.MEDIA_TYPES,
            c = this.FILE_TYPES;
        switch (a) {
            case b.PHOTO:
            case b.STREAM:
            case b.COVER:
            case b.PROFILE:
            case b.PLAYLIST:
            case b.ALBUMART:
            case b.SONGART:
            case b.VIDEOTHUMBNAIL:
                return c.PHOTO;
            case b.VIDEO:
                return c.VIDEO;
            case b.SONG:
                return c.AUDIO;
            case b.TEMP:
                return c.ALL;
            default:
                return c.ALL
        }
    }, Myspace.Upload.GetUploadEndpoint = function (a) {
        var b = config.urls.upload;
        switch (a) {
            case this.MEDIA_TYPES.VIDEOTHUMBNAIL:
                b += "video/thumbnail";
                break;
            case this.MEDIA_TYPES.SONG:
                b += "music/song";
                break;
            case this.MEDIA_TYPES.SONGART:
                b += "music/song/art";
                break;
            case this.MEDIA_TYPES.ALBUMART:
                b += "music/album/art";
                break;
            default:
                b += a
        }
        return b
    }, Myspace.Upload.GetMinimumDimensions = function (a) {
        switch (a) {
            case this.MEDIA_TYPES.PHOTO:
                return this.MIN_IMAGE_DIMENSIONS.PHOTO;
            case this.MEDIA_TYPES.STREAM:
                return this.MIN_IMAGE_DIMENSIONS.STREAM;
            case this.MEDIA_TYPES.COVER:
                return this.MIN_IMAGE_DIMENSIONS.COVER;
            case this.MEDIA_TYPES.PROFILE:
                return this.MIN_IMAGE_DIMENSIONS.PROFILE;
            case this.MEDIA_TYPES.PLAYLIST:
                return this.MIN_IMAGE_DIMENSIONS.PLAYLIST;
            case this.MEDIA_TYPES.ALBUMART:
                return this.MIN_IMAGE_DIMENSIONS.ALBUMART;
            case this.MEDIA_TYPES.SONGART:
                return this.MIN_IMAGE_DIMENSIONS.SONGART;
            case this.MEDIA_TYPES.VIDEO:
            case this.MEDIA_TYPES.VIDEOTHUMBNAIL:
                return this.MIN_IMAGE_DIMENSIONS.VIDEOTHUMBNAIL;
            default:
                return [0, 0]
        }
    }, Myspace.Upload.BytesToBiggerBytes = function (a) {
        return a > 1073741824 ? (Math.floor(a * 100 / 1073741824) / 100).toString() + "GB" : a > 1048576 ? (Math.floor(a * 100 / 1048576) / 100).toString() + "MB" : (Math.floor(a * 100 / 1024) / 100).toString() + "KB"
    }, Myspace.Upload.ValidateMinimumImageDimensions = function (a, b, c) {
        var d = this.GetMinimumDimensions(a);
        if (!d) {
            c(!0);
            return
        }
        if (window.FileReader) {
            var e = new FileReader;
            e.onload = function (a) {
                var b = new Image;
                b.src = a.target.result, b.onload = function () {
                    c(b.width >= d[0] && b.height >= d[1])
                }
            }, e.readAsDataURL(b)
        } else c(!0)
    }, Myspace.Upload.IsMediaTypeAnImage = function (a) {
        var b = this.MEDIA_TYPES;
        return a != b.VIDEO && a != b.SONG
    }, Myspace.Upload.IsAcceptedFileType = function (a, c) {
        var d = this.GetAcceptableFileTypes(a);
        if (d == "*.*") return !0;
        var e = d.split(";"),
            f = b(c);
        for (var g = 0; g < e.length; g++) if ("*" + f == e[g]) return !0;
        return !1
    }, Myspace.Upload.PreProcess = function (a, e, f) {
        if (!config.resizePhotoUploadsOnClient || context.roles !== undefined && context.roles.indexOf("Photographer") !== -1) f(e);
        else {
            var g = 2048,
                h = 2097152,
                i = window.FileReader ? new FileReader : null,
                j = b(e);
            !i || j !== ".jpg" && j !== ".jpeg" ? f(e) : (i.onload = function (a) {
                try {
                    var b = new Blob([a.target.result]),
                        j = window.URL || window.webkitURL,
                        k = new Image;
                    k.src = j.createObjectURL(b), k.onload = function () {
                        try {
                            if (e.size > h || k.width >= g || k.height >= g) {
                                var a = document.createElement("canvas").getContext("2d"),
                                    l = c(k, g, g);
                                a.canvas.height = l.height, a.canvas.width = l.width, a.drawImage(k, 0, 0, k.width, k.height, 0, 0, l.width, l.height);
                                var m = a.canvas.toDataURL("image/jpeg", .98),
                                    n = JpegAPPMarkers.copyMarkers(i.result, d(m));
                                j.revokeObjectURL(b), f(n)
                            } else f(e)
                        } catch (o) {
                            f(e)
                        }
                    }
                } catch (l) {
                    f(e)
                }
            }, i.readAsArrayBuffer(e))
        }
    }, Myspace.Upload.PosterUpload = function (b, c, d, e) {
        var f = new XMLHttpRequest,
            g = new FormData,
            h = this;
        for (var i in b) g.append(i, b[i]);
        f.open("POST", h.GetUploadEndpoint(c), !0), f.onreadystatechange = function (g) {
            if (f.readyState == 4) {
                var i = a.parseJSON(f.responseText)[0];
                if (f.status == 200) {
                    if (i.success) d && d(i);
                    else if (e) {
                        var j = h.MapServerError(i.error);
                        e({
                            errorCode: j,
                            errorMessage: h.GetErrorMessage(null, j, c)
                        })
                    }
                } else e && e({
                        errorCode: h.ERROR_CODES.UPLOAD_FAILED,
                        errorMessage: h.GetErrorMessage(null, h.ERROR_CODES.UPLOAD_FAILED, c)
                    })
            }
        }, f.send(g)
    }
})(jQuery);
(function (a) {
    var b = function () {
        function p() {
            h = a(m), a("#wrap").append(h), i = new Myspace.Dialog(h, {
                closeAll: !1
            }), w()
        }
        function q() {
            if (b == "" || c == "") return;
            l = !1, h.find(".primary.save").removeAttr("disabled"), i.show()
        }
        function r() {
            i.hide()
        }
        function s(a) {
            var d = a || {};
            b = d.imageUrl || b, c = d.imageType || c, j = d.croppedValues || j, f = d.successCallback || f, g = d.failedCallback || g, l = !0;
            var e = {
                utoken: context.hashMashter,
                url: b,
                photoType: c,
                selected: d.selected,
                width: j.width,
                height: j.height,
                x: j.x,
                y: j.y
            };
            switch (d.type) {
                case "song":
                    e.songReleaseId = d.mediaReleaseId;
                    break;
                case "album":
                    e.albumReleaseId = d.mediaReleaseId;
                    break;
                case "video":
                    e.videoReleaseId = d.mediaReleaseId
            }
            o.PosterUpload(e, c, function (a) {
                l = !1, f(a)
            }, function (b) {
                l = !1, g(b), Myspace.Error({
                    yes: {
                        onClick: function () {
                            setTimeout(function () {
                                return s(a)
                            }, 550)
                        }
                    }
                })
            }), r()
        }
        function t(a) {
            j = {}, j.width = Math.floor(a.w), j.height = Math.floor(a.h);
            var b = 1;
            j.width > d.width ? b = d.width / j.width : j.height > d.height && (b = d.height / j.height), j.width = Math.floor(j.width * b), j.height = Math.floor(j.height * b), j.x = Math.floor(a.x * b), j.y = Math.floor(a.y * b), j.width + j.x > d.width && (j.x -= j.width + j.x - d.width), j.height + j.y > d.height && (j.y -= j.height + j.y - d.height)
        }
        function u(i, l) {
            a("#photoCropper").length || p(), i.photoType && (c = i.photoType), i.successCallback && (f = i.successCallback), i.failedCallback && (g = i.failedCallback), i.photoDimensions && (d = i.photoDimensions), i.aspectRatio && (e = i.aspectRatio);
            if (i.photoUrl) {
                var m = h.find(".cropContainer"),
                    q = m.children("img"),
                    r = o.GetMinimumDimensions(c),
                    s = v(r);
                q.length && k.destroy(), j = {
                    width: 0,
                    height: 0,
                    x: 0,
                    y: 0
                }, m.html('<img src="' + i.photoUrl + '" alt=""/>'), b = i.photoUrl, m.children("img").Jcrop({
                    onRelease: function () {
                        j = {
                            width: 0,
                            height: 0,
                            x: 0,
                            y: 0
                        }
                    },
                    onSelect: t,
                    minSize: r == "none" ? 0 : r,
                    boxWidth: 400,
                    boxHeight: 400,
                    setSelect: s,
                    aspectRatio: e
                }, function () {
                    k = this, s && this.setSelect(s), l && l()
                })
            }
            n = typeof i.onSave == "function" ? i.onSave : undefined
        }
        function v(a) {
            var b = undefined;
            if (d) {
                var c = d.width / d.height;
                if (!a || c === e) b = [0, 0, d.width, d.height];
                else {
                    var f = Math.floor(d.width / e),
                        g = d.height * e,
                        h = Math.floor((d.width - g) / 2),
                        i = Math.floor((d.height - f) / 2);
                    c >= 1 ? e > 1 ? f <= d.height ? b = [0, i, d.width, f] : b = [h, 0, g, d.height] : (g = Math.floor(d.height / e), h = Math.floor((d.width - g) / 2), b = [h, 0, g, d.height]) : b = [0, i, d.width, f]
                }
            }
            return b
        }
        function w() {
            h.on("click", "i, button", function (b) {
                var c = b.target.className;
                c == "x_18_border" || c == "cancel" ? r() : c == "primary save" && (a(this).attr("disabled", "disabled"), n && n(j) === !1 ? (l = !0, r()) : s())
            })
        }
        var b = "",
            c = "",
            d = undefined,
            e = 1,
            f = null,
            g = null,
            h, i, j = {
                width: 0,
                height: 0,
                x: 0,
                y: 0
            }, k, l = !1,
            m = templates["common/views/generic/photos/_photoCropper"],
            n, o = Myspace.Upload;
        return comm.listen("dialog.hiding", function (a) {
            a.attr("id") == "photoCropper" && (comm.send("photoCropper.hiding"), !l && comm.send("photoCropper.canceled"))
        }, !0), {
            show: q,
            hide: r,
            setOptions: u,
            save: s
        }
    };
    Myspace.PhotoCropper = b()
})(jQuery);
(function (a) {
    a.Jcrop = function (b, c) {
        function h(a) {
            return Math.round(a) + "px"
        }
        function i(a) {
            return d.baseClass + "-" + a
        }
        function j() {
            return a.fx.step.hasOwnProperty("backgroundColor")
        }
        function k(b) {
            var c = a(b).offset();
            return [c.left, c.top]
        }
        function l(a) {
            return [a.pageX - e[0], a.pageY - e[1]]
        }
        function m(b) {
            typeof b != "object" && (b = {}), d = a.extend(d, b), a.each(["onChange", "onSelect", "onRelease", "onDblClick"], function (a, b) {
                typeof d[b] != "function" && (d[b] = function () {})
            })
        }
        function n(a, b, c) {
            e = k(C), bb.setCursor(a === "move" ? a : a + "-resize");
            if (a === "move") return bb.activateHandlers(p(b), u, c);
            var d = Z.getFixed(),
                f = q(a),
                g = Z.getCorner(q(f));
            Z.setPressed(Z.getCorner(f)), Z.setCurrent(g), bb.activateHandlers(o(a, d), u, c)
        }
        function o(a, b) {
            return function (c) {
                if (!d.aspectRatio) switch (a) {
                        case "e":
                            c[1] = b.y2;
                            break;
                        case "w":
                            c[1] = b.y2;
                            break;
                        case "n":
                            c[0] = b.x2;
                            break;
                        case "s":
                            c[0] = b.x2
                } else switch (a) {
                        case "e":
                            c[1] = b.y + 1;
                            break;
                        case "w":
                            c[1] = b.y + 1;
                            break;
                        case "n":
                            c[0] = b.x + 1;
                            break;
                        case "s":
                            c[0] = b.x + 1
                }
                Z.setCurrent(c), ab.update()
            }
        }
        function p(a) {
            var b = a;
            return cb.watchKeys(),
            function (a) {
                Z.moveOffset([a[0] - b[0], a[1] - b[1]]), b = a, ab.update()
            }
        }
        function q(a) {
            switch (a) {
                case "n":
                    return "sw";
                case "s":
                    return "nw";
                case "e":
                    return "nw";
                case "w":
                    return "ne";
                case "ne":
                    return "sw";
                case "nw":
                    return "se";
                case "se":
                    return "nw";
                case "sw":
                    return "ne"
            }
        }
        function r(a) {
            return function (b) {
                return d.disabled ? !1 : a === "move" && !d.allowMove ? !1 : (e = k(C), V = !0, n(a, l(b)), b.stopPropagation(), b.preventDefault(), !1)
            }
        }
        function s(a, b, c) {
            var d = a.width(),
                e = a.height();
            d > b && b > 0 && (d = b, e = b / a.width() * a.height()), e > c && c > 0 && (e = c, d = c / a.height() * a.width()), S = a.width() / d, T = a.height() / e, a.width(d).height(e)
        }
        function t(a) {
            return {
                x: a.x * S,
                y: a.y * T,
                x2: a.x2 * S,
                y2: a.y2 * T,
                w: a.w * S,
                h: a.h * T
            }
        }
        function u(a) {
            var b = Z.getFixed();
            b.w > d.minSelect[0] && b.h > d.minSelect[1] ? (ab.enableHandles(), ab.done()) : ab.release(), bb.setCursor(d.allowSelect ? "crosshair" : "default")
        }
        function v(a) {
            if (d.disabled) return !1;
            if (!d.allowSelect) return !1;
            V = !0, e = k(C), ab.disableHandles(), bb.setCursor("crosshair");
            var b = l(a);
            return Z.setPressed(b), ab.update(), bb.activateHandlers(w, u, a.type.substring(0, 5) === "touch"), cb.watchKeys(), a.stopPropagation(), a.preventDefault(), !1
        }
        function w(a) {
            Z.setCurrent(a), ab.update()
        }
        function x() {
            var b = a("<div></div>").addClass(i("tracker"));
            return a.browser.msie && b.css({
                opacity: 0,
                backgroundColor: "white"
            }), b
        }
        function db(a) {
            F.removeClass().addClass(i("holder")).addClass(a)
        }
        function eb(a, b) {
            function t() {
                window.setTimeout(u, l)
            }
            var c = a[0] / S,
                e = a[1] / T,
                f = a[2] / S,
                g = a[3] / T;
            if (W) return;
            var h = Z.flipCoords(c, e, f, g),
                i = Z.getFixed(),
                j = [i.x, i.y, i.x2, i.y2],
                k = j,
                l = d.animationDelay,
                m = h[0] - j[0],
                n = h[1] - j[1],
                o = h[2] - j[2],
                p = h[3] - j[3],
                q = 0,
                r = d.swingSpeed;
            c = k[0], e = k[1], f = k[2], g = k[3], ab.animMode(!0);
            var s, u = function () {
                    return function () {
                        q += (100 - q) / r, k[0] = Math.round(c + q / 100 * m), k[1] = Math.round(e + q / 100 * n), k[2] = Math.round(f + q / 100 * o), k[3] = Math.round(g + q / 100 * p), q >= 99.8 && (q = 100), q < 100 ? (gb(k), t()) : (ab.done(), ab.animMode(!1), typeof b == "function" && b.call(rb))
                    }
                }();
            t()
        }
        function fb(a) {
            gb([a[0] / S, a[1] / T, a[2] / S, a[3] / T]), d.onSelect.call(rb, t(Z.getFixed())), ab.enableHandles()
        }
        function gb(a) {
            Z.setPressed([a[0], a[1]]), Z.setCurrent([a[2], a[3]]), ab.update()
        }
        function hb() {
            return t(Z.getFixed())
        }
        function ib() {
            return Z.getFixed()
        }
        function jb(a) {
            m(a), qb()
        }
        function kb() {
            d.disabled = !0, ab.disableHandles(), ab.setCursor("default"), bb.setCursor("default")
        }
        function lb() {
            d.disabled = !1, qb()
        }
        function mb() {
            ab.done(), bb.activateHandlers(null, null)
        }
        function nb() {
            F.remove(), z.show(), z.css("visibility", "visible"), a(b).removeData("Jcrop")
        }
        function ob(a, b) {
            ab.release(), kb();
            var c = new Image;
            c.onload = function () {
                var e = c.width,
                    f = c.height,
                    g = d.boxWidth,
                    h = d.boxHeight;
                C.width(e).height(f), C.attr("src", a), G.attr("src", a), s(C, g, h), D = C.width(), E = C.height(), G.width(D).height(E), L.width(D + K * 2).height(E + K * 2), F.width(D).height(E), _.resize(D, E), lb(), typeof b == "function" && b.call(rb)
            }, c.src = a
        }
        function pb(a, b, c) {
            var e = b || d.bgColor;
            d.bgFade && j() && d.fadeTime && !c ? a.animate({
                backgroundColor: e
            }, {
                queue: !1,
                duration: d.fadeTime
            }) : a.css("backgroundColor", e)
        }
        function qb(a) {
            d.allowResize ? a ? ab.enableOnly() : ab.enableHandles() : ab.disableHandles(), bb.setCursor(d.allowSelect ? "crosshair" : "default"), ab.setCursor(d.allowMove ? "move" : "default"), d.hasOwnProperty("trueSize") && (S = d.trueSize[0] / D, T = d.trueSize[1] / E), d.hasOwnProperty("setSelect") && (fb(d.setSelect), ab.done(), delete d.setSelect), _.refresh(), d.bgColor != M && (pb(d.shade ? _.getShades() : F, d.shade ? d.shadeColor || d.bgColor : d.bgColor), M = d.bgColor), N != d.bgOpacity && (N = d.bgOpacity, d.shade ? _.refresh() : ab.setBgOpacity(N)), O = d.maxSize[0] || 0, P = d.maxSize[1] || 0, Q = d.minSize[0] || 0, R = d.minSize[1] || 0, d.hasOwnProperty("outerImage") && (C.attr("src", d.outerImage), delete d.outerImage), ab.refresh()
        }
        var d = a.extend({}, a.Jcrop.defaults),
            e, f, g = !1;
        a.browser.msie && a.browser.version.split(".")[0] === "6" && (g = !0), typeof b != "object" && (b = a(b)[0]), typeof c != "object" && (c = {}), m(c);
        var y = {
            border: "none",
            visibility: "visible",
            margin: 0,
            padding: 0,
            position: "absolute",
            top: 0,
            left: 0
        }, z = a(b),
            A = !0;
        if (b.tagName == "IMG") {
            if (z[0].width != 0 && z[0].height != 0) z.width(z[0].width), z.height(z[0].height);
            else {
                var B = new Image;
                B.src = z[0].src, z.width(B.width), z.height(B.height)
            }
            var C = z.clone().removeAttr("id").css(y).show();
            C.width(z.width()), C.height(z.height()), z.after(C).hide()
        } else C = z.css(y).show(), A = !1, d.shade === null && (d.shade = !0);
        s(C, d.boxWidth, d.boxHeight);
        var D = C.width(),
            E = C.height(),
            F = a("<div />").width(D).height(E).addClass(i("holder")).css({
                position: "relative",
                backgroundColor: d.bgColor
            }).insertAfter(z).append(C);
        d.addClass && F.addClass(d.addClass);
        var G = a("<div />"),
            H = a("<div />").width("100%").height("100%").css({
                zIndex: 310,
                position: "absolute",
                overflow: "hidden"
            }),
            I = a("<div />").width("100%").height("100%").css("zIndex", 320),
            J = a("<div />").css({
                position: "absolute",
                zIndex: 600
            }).dblclick(function () {
                var a = Z.getFixed();
                d.onDblClick.call(rb, a)
            }).insertBefore(C).append(H, I);
        A && (G = a("<img />").attr("src", C.attr("src")).css(y).width(D).height(E), H.append(G)), g && J.css({
            overflowY: "hidden"
        });
        var K = d.boundary,
            L = x().width(D + K * 2).height(E + K * 2).css({
                position: "absolute",
                top: h(-K),
                left: h(-K),
                zIndex: 290
            }).mousedown(v),
            M = d.bgColor,
            N = d.bgOpacity,
            O, P, Q, R, S, T, U = !0,
            V, W, X;
        e = k(C);
        var Y = function () {
            function a() {
                var a = {}, b = ["touchstart", "touchmove", "touchend"],
                    c = document.createElement("div"),
                    d;
                try {
                    for (d = 0; d < b.length; d++) {
                        var e = b[d];
                        e = "on" + e;
                        var f = e in c;
                        f || (c.setAttribute(e, "return;"), f = typeof c[e] == "function"), a[b[d]] = f
                    }
                    return a.touchstart && a.touchend && a.touchmove
                } catch (g) {
                    return !1
                }
            }
            function b() {
                return d.touchSupport === !0 || d.touchSupport === !1 ? d.touchSupport : a()
            }
            return {
                createDragger: function (a) {
                    return function (b) {
                        return d.disabled ? !1 : a === "move" && !d.allowMove ? !1 : (e = k(C), V = !0, n(a, l(Y.cfilter(b)), !0), b.stopPropagation(), b.preventDefault(), !1)
                    }
                },
                newSelection: function (a) {
                    return v(Y.cfilter(a))
                },
                cfilter: function (a) {
                    return a.pageX = a.originalEvent.changedTouches[0].pageX, a.pageY = a.originalEvent.changedTouches[0].pageY, a
                },
                isSupported: a,
                support: b()
            }
        }(),
            Z = function () {
                function h(d) {
                    d = n(d), c = a = d[0], e = b = d[1]
                }
                function i(a) {
                    a = n(a), f = a[0] - c, g = a[1] - e, c = a[0], e = a[1]
                }
                function j() {
                    return [f, g]
                }
                function k(d) {
                    var f = d[0],
                        g = d[1];
                    0 > a + f && (f -= f + a), 0 > b + g && (g -= g + b), E < e + g && (g += E - (e + g)), D < c + f && (f += D - (c + f)), a += f, c += f, b += g, e += g
                }
                function l(a) {
                    var b = m();
                    switch (a) {
                        case "ne":
                            return [b.x2, b.y];
                        case "nw":
                            return [b.x, b.y];
                        case "se":
                            return [b.x2, b.y2];
                        case "sw":
                            return [b.x, b.y2]
                    }
                }
                function m() {
                    if (!d.aspectRatio) return p();
                    var f = d.aspectRatio,
                        g = d.minSize[0] / S,
                        h = d.maxSize[0] / S,
                        i = d.maxSize[1] / T,
                        j = c - a,
                        k = e - b,
                        l = Math.abs(j),
                        m = Math.abs(k),
                        n = l / m,
                        r, s, t, u;
                    return h === 0 && (h = D * 10), i === 0 && (i = E * 10), n < f ? (s = e, t = m * f, r = j < 0 ? a - t : t + a, r < 0 ? (r = 0, u = Math.abs((r - a) / f), s = k < 0 ? b - u : u + b) : r > D && (r = D, u = Math.abs((r - a) / f), s = k < 0 ? b - u : u + b)) : (r = c, u = l / f, s = k < 0 ? b - u : b + u, s < 0 ? (s = 0, t = Math.abs((s - b) * f), r = j < 0 ? a - t : t + a) : s > E && (s = E, t = Math.abs(s - b) * f, r = j < 0 ? a - t : t + a)), r > a ? (r - a < g ? r = a + g : r - a > h && (r = a + h), s > b ? s = b + (r - a) / f : s = b - (r - a) / f) : r < a && (a - r < g ? r = a - g : a - r > h && (r = a - h), s > b ? s = b + (a - r) / f : s = b - (a - r) / f), r < 0 ? (a -= r, r = 0) : r > D && (a -= r - D, r = D), s < 0 ? (b -= s, s = 0) : s > E && (b -= s - E, s = E), q(o(a, b, r, s))
                }
                function n(a) {
                    return a[0] < 0 && (a[0] = 0), a[1] < 0 && (a[1] = 0), a[0] > D && (a[0] = D), a[1] > E && (a[1] = E), [Math.round(a[0]), Math.round(a[1])]
                }
                function o(a, b, c, d) {
                    var e = a,
                        f = c,
                        g = b,
                        h = d;
                    return c < a && (e = c, f = a), d < b && (g = d, h = b), [e, g, f, h]
                }
                function p() {
                    var d = c - a,
                        f = e - b,
                        g;
                    return O && Math.abs(d) > O && (c = d > 0 ? a + O : a - O), P && Math.abs(f) > P && (e = f > 0 ? b + P : b - P), R / T && Math.abs(f) < R / T && (e = f > 0 ? b + R / T : b - R / T), Q / S && Math.abs(d) < Q / S && (c = d > 0 ? a + Q / S : a - Q / S), a < 0 && (c -= a, a -= a), b < 0 && (e -= b, b -= b), c < 0 && (a -= c, c -= c), e < 0 && (b -= e, e -= e), c > D && (g = c - D, a -= g, c -= g), e > E && (g = e - E, b -= g, e -= g), a > D && (g = a - E, e -= g, b -= g), b > E && (g = b - E, e -= g, b -= g), q(o(a, b, c, e))
                }
                function q(a) {
                    return {
                        x: a[0],
                        y: a[1],
                        x2: a[2],
                        y2: a[3],
                        w: a[2] - a[0],
                        h: a[3] - a[1]
                    }
                }
                var a = 0,
                    b = 0,
                    c = 0,
                    e = 0,
                    f, g;
                return {
                    flipCoords: o,
                    setPressed: h,
                    setCurrent: i,
                    getOffset: j,
                    moveOffset: k,
                    getCorner: l,
                    getFixed: m
                }
            }(),
            _ = function () {
                function f(a, b) {
                    e.left.css({
                        height: h(b)
                    }), e.right.css({
                        height: h(b)
                    })
                }
                function g() {
                    return i(Z.getFixed())
                }
                function i(a) {
                    e.top.css({
                        left: h(a.x),
                        width: h(a.w),
                        height: h(a.y)
                    }), e.bottom.css({
                        top: h(a.y2),
                        left: h(a.x),
                        width: h(a.w),
                        height: h(E - a.y2)
                    }), e.right.css({
                        left: h(a.x2),
                        width: h(D - a.x2)
                    }), e.left.css({
                        width: h(a.x)
                    })
                }
                function j() {
                    return a("<div />").css({
                        position: "absolute",
                        backgroundColor: d.shadeColor || d.bgColor
                    }).appendTo(c)
                }
                function k() {
                    b || (b = !0, c.insertBefore(C), g(), ab.setBgOpacity(1, 0, 1), G.hide(), l(d.shadeColor || d.bgColor, 1), ab.isAwake() ? n(d.bgOpacity, 1) : n(1, 1))
                }
                function l(a, b) {
                    pb(p(), a, b)
                }
                function m() {
                    b && (c.remove(), G.show(), b = !1, ab.isAwake() ? ab.setBgOpacity(d.bgOpacity, 1, 1) : (ab.setBgOpacity(1, 1, 1), ab.disableHandles()), pb(F, 0, 1))
                }
                function n(a, e) {
                    b && (d.bgFade && !e ? c.animate({
                        opacity: 1 - a
                    }, {
                        queue: !1,
                        duration: d.fadeTime
                    }) : c.css({
                        opacity: 1 - a
                    }))
                }
                function o() {
                    d.shade ? k() : m(), ab.isAwake() && n(d.bgOpacity)
                }
                function p() {
                    return c.children()
                }
                var b = !1,
                    c = a("<div />").css({
                        position: "absolute",
                        zIndex: 240,
                        opacity: 0
                    }),
                    e = {
                        top: j(),
                        left: j().height(E),
                        right: j().height(E),
                        bottom: j()
                    };
                return {
                    update: g,
                    updateRaw: i,
                    getShades: p,
                    setBgColor: l,
                    enable: k,
                    disable: m,
                    resize: f,
                    refresh: o,
                    opacity: n
                }
            }(),
            ab = function () {
                function k(b) {
                    var c = a("<div />").css({
                        position: "absolute",
                        opacity: d.borderOpacity
                    }).addClass(i(b));
                    return H.append(c), c
                }
                function l(b, c) {
                    var d = a("<div />").mousedown(r(b)).css({
                        cursor: b + "-resize",
                        position: "absolute",
                        zIndex: c
                    }).addClass("ord-" + b);
                    return Y.support && d.bind("touchstart.jcrop", Y.createDragger(b)), I.append(d), d
                }
                function m(a) {
                    var b = d.handleSize;
                    return l(a, c++).css({
                        opacity: d.handleOpacity
                    }).width(b).height(b).addClass(i("handle"))
                }
                function n(a) {
                    return l(a, c++).addClass("jcrop-dragbar")
                }
                function o(a) {
                    var b;
                    for (b = 0; b < a.length; b++) g[a[b]] = n(a[b])
                }
                function p(a) {
                    var b, c;
                    for (c = 0; c < a.length; c++) {
                        switch (a[c]) {
                            case "n":
                                b = "hline";
                                break;
                            case "s":
                                b = "hline bottom";
                                break;
                            case "e":
                                b = "vline right";
                                break;
                            case "w":
                                b = "vline"
                        }
                        e[a[c]] = k(b)
                    }
                }
                function q(a) {
                    var b;
                    for (b = 0; b < a.length; b++) f[a[b]] = m(a[b])
                }
                function s(a, b) {
                    d.shade || G.css({
                        top: h(-b),
                        left: h(-a)
                    }), J.css({
                        top: h(b),
                        left: h(a)
                    })
                }
                function u(a, b) {
                    J.width(Math.round(a)).height(Math.round(b))
                }
                function v() {
                    var a = Z.getFixed();
                    Z.setPressed([a.x, a.y]), Z.setCurrent([a.x2, a.y2]), w()
                }
                function w(a) {
                    if (b) return y(a)
                }
                function y(a) {
                    var c = Z.getFixed();
                    u(c.w, c.h), s(c.x, c.y), d.shade && _.updateRaw(c), b || A(), a ? d.onSelect.call(rb, t(c)) : d.onChange.call(rb, t(c))
                }
                function z(a, c, e) {
                    if (!b && !c) return;
                    d.bgFade && !e ? C.animate({
                        opacity: a
                    }, {
                        queue: !1,
                        duration: d.fadeTime
                    }) : C.css("opacity", a)
                }
                function A() {
                    J.show(), d.shade ? _.opacity(N) : z(N, !0), b = !0
                }
                function B() {
                    F(), J.hide(), d.shade ? _.opacity(1) : z(1), b = !1, d.onRelease.call(rb)
                }
                function D() {
                    j && I.show()
                }
                function E() {
                    j = !0;
                    if (d.allowResize) return I.show(), !0
                }
                function F() {
                    j = !1, I.hide()
                }
                function K(a) {
                    a ? (W = !0, F()) : (W = !1, E())
                }
                function L() {
                    K(!1), v()
                }
                var b, c = 370,
                    e = {}, f = {}, g = {}, j = !1;
                d.dragEdges && a.isArray(d.createDragbars) && o(d.createDragbars), a.isArray(d.createHandles) && q(d.createHandles), d.drawBorders && a.isArray(d.createBorders) && p(d.createBorders), a(document).bind("touchstart.jcrop-ios", function (b) {
                    a(b.currentTarget).hasClass("jcrop-tracker") && b.stopPropagation()
                });
                var M = x().mousedown(r("move")).css({
                    cursor: "move",
                    position: "absolute",
                    zIndex: 360
                });
                return Y.support && M.bind("touchstart.jcrop", Y.createDragger("move")), H.append(M), F(), {
                    updateVisible: w,
                    update: y,
                    release: B,
                    refresh: v,
                    isAwake: function () {
                        return b
                    },
                    setCursor: function (a) {
                        M.css("cursor", a)
                    },
                    enableHandles: E,
                    enableOnly: function () {
                        j = !0
                    },
                    showHandles: D,
                    disableHandles: F,
                    animMode: K,
                    setBgOpacity: z,
                    done: L
                }
            }(),
            bb = function () {
                function f(b) {
                    L.css({
                        zIndex: 450
                    }), b ? a(document).bind("touchmove.jcrop", k).bind("touchend.jcrop", m) : e && a(document).bind("mousemove.jcrop", h).bind("mouseup.jcrop", i)
                }
                function g() {
                    L.css({
                        zIndex: 290
                    }), a(document).unbind(".jcrop")
                }
                function h(a) {
                    return b(l(a)), !1
                }
                function i(a) {
                    return a.preventDefault(), a.stopPropagation(), V && (V = !1, c(l(a)), ab.isAwake() && d.onSelect.call(rb, t(Z.getFixed())), g(), b = function () {}, c = function () {}), !1
                }
                function j(a, d, e) {
                    return V = !0, b = a, c = d, f(e), !1
                }
                function k(a) {
                    return b(l(Y.cfilter(a))), !1
                }
                function m(a) {
                    return i(Y.cfilter(a))
                }
                function n(a) {
                    L.css("cursor", a)
                }
                var b = function () {}, c = function () {}, e = d.trackDocument;
                return e || L.mousemove(h).mouseup(i).mouseout(i), C.before(L), {
                    activateHandlers: j,
                    setCursor: n
                }
            }(),
            cb = function () {
                function e() {
                    d.keySupport && (b.show(), b.focus())
                }
                function f(a) {
                    b.hide()
                }
                function h(a, b, c) {
                    d.allowMove && (Z.moveOffset([b, c]), ab.updateVisible(!0)), a.preventDefault(), a.stopPropagation()
                }
                function i(a) {
                    if (a.ctrlKey || a.metaKey) return !0;
                    X = a.shiftKey ? !0 : !1;
                    var b = X ? 10 : 1;
                    switch (a.keyCode) {
                        case 37:
                            h(a, -b, 0);
                            break;
                        case 39:
                            h(a, b, 0);
                            break;
                        case 38:
                            h(a, 0, -b);
                            break;
                        case 40:
                            h(a, 0, b);
                            break;
                        case 27:
                            d.allowSelect && ab.release();
                            break;
                        case 9:
                            return !0
                    }
                    return !1
                }
                var b = a('<input type="radio" />').css({
                    position: "fixed",
                    left: "-120px",
                    width: "12px"
                }).addClass("jcrop-keymgr"),
                    c = a("<div />").css({
                        position: "absolute",
                        overflow: "hidden"
                    }).append(b);
                return d.keySupport && (b.keydown(i).blur(f), g || !d.fixedSupport ? (b.css({
                    position: "absolute",
                    left: "-20px"
                }), c.append(b).insertBefore(C)) : b.insertBefore(C)), {
                    watchKeys: e
                }
            }();
        Y.support && L.bind("touchstart.jcrop", Y.newSelection), I.hide(), qb(!0);
        var rb = {
            setImage: ob,
            animateTo: eb,
            setSelect: fb,
            setOptions: jb,
            tellSelect: hb,
            tellScaled: ib,
            setClass: db,
            disable: kb,
            enable: lb,
            cancel: mb,
            release: ab.release,
            destroy: nb,
            focus: cb.watchKeys,
            getBounds: function () {
                return [D * S, E * T]
            },
            getWidgetSize: function () {
                return [D, E]
            },
            getScaleFactor: function () {
                return [S, T]
            },
            getOptions: function () {
                return d
            },
            ui: {
                holder: F,
                selection: J
            }
        };
        return a.browser.msie && F.bind("selectstart", function () {
            return !1
        }), z.data("Jcrop", rb), rb
    }, a.fn.Jcrop = function (b, c) {
        var d;
        return this.each(function () {
            if (a(this).data("Jcrop")) {
                if (b === "api") return a(this).data("Jcrop");
                a(this).data("Jcrop").setOptions(b)
            } else this.tagName == "IMG" ? a.Jcrop.Loader(this, function () {
                    a(this).css({
                        display: "block",
                        visibility: "hidden"
                    }), d = a.Jcrop(this, b), a.isFunction(c) && c.call(d)
                }) : (a(this).css({
                    display: "block",
                    visibility: "hidden"
                }), d = a.Jcrop(this, b), a.isFunction(c) && c.call(d))
        }), this
    }, a.Jcrop.Loader = function (b, c, d) {
        function g() {
            f.complete ? (e.unbind(".jcloader"), a.isFunction(c) && c.call(f)) : window.setTimeout(g, 50)
        }
        var e = a(b),
            f = e[0];
        e.bind("load.jcloader", g).bind("error.jcloader", function (b) {
            e.unbind(".jcloader"), a.isFunction(d) && d.call(f)
        }), f.complete && a.isFunction(c) && (e.unbind(".jcloader"), c.call(f))
    }, a.Jcrop.defaults = {
        allowSelect: !0,
        allowMove: !0,
        allowResize: !0,
        trackDocument: !0,
        baseClass: "jcrop",
        addClass: null,
        bgColor: "black",
        bgOpacity: .6,
        bgFade: !1,
        borderOpacity: .4,
        handleOpacity: .5,
        handleSize: 7,
        aspectRatio: 0,
        keySupport: !0,
        createHandles: ["n", "s", "e", "w", "nw", "ne", "se", "sw"],
        createDragbars: ["n", "s", "e", "w"],
        createBorders: ["n", "s", "e", "w"],
        drawBorders: !0,
        dragEdges: !0,
        fixedSupport: !0,
        touchSupport: null,
        shade: null,
        boxWidth: 0,
        boxHeight: 0,
        boundary: 2,
        fadeTime: 400,
        animationDelay: 20,
        swingSpeed: 3,
        minSelect: [0, 0],
        maxSize: [0, 0],
        minSize: [0, 0],
        onChange: function () {},
        onSelect: function () {},
        onDblClick: function () {},
        onRelease: function () {}
    }
})(jQuery);
(function (a) {
    Myspace.PhotoCarousel = function (b, c) {
        function z() {
            I(), d.on("click", ".cell,i", function (a) {
                a.clientX < d.width() * .5 ? (B(), comm.send("track", new Tracking("photodetail", "Invoke", "MainLeftArrow"))) : (A(), comm.send("track", new Tracking("photodetail", "Invoke", "MainRightArrow")));
                if (!y.lightboxMode) return !1
            }), i.on("click", function (b) {
                var c = a(b.target),
                    d = c.data("action");
                if (b.target.tagName === "I") {
                    switch (d) {
                        case "prevItem":
                            comm.send("track", new Tracking("photodetail", "Invoke", "SmallLeftArrow")), B();
                            break;
                        case "nextItem":
                            comm.send("track", new Tracking("photodetail", "Invoke", "SmallRightArrow")), A()
                    }
                    return !1
                }
                if (b.target.tagName !== "A") return !1;
                switch (d) {
                    case "reportAbuse":
                        return comm.send("reportAbuse", {
                            type: "photo",
                            entityKey: c.data("entityKey"),
                            userEntityKey: c.data("userEntityKey")
                        }), !1
                }
            }), o.find("i").hover(function () {
                p.show()
            }, function () {
                p.hide()
            }), y.items.length > 0 && (v = y.items[y.currentIndex]), J(y.speed), q.bind("resize", I), y.lightboxMode || (a("body").bind("keydown", M), O())
        }
        function A() {
            w || C(y.currentIndex + 1)
        }
        function B() {
            w || C(y.currentIndex - 1)
        }
        function C(a, b, c) {
            if (P()) {
                if (y.items.length === 1) {
                    y.carouselSuccessCB();
                    return
                }
                y.items.length > 1 && (D(a, b == 1, c), y.carouselSuccessCB())
            } else {
                if (y.items.length > 0 && v.albumIdTotalCount === 1) {
                    y.carouselSuccessCB();
                    return
                }
                y.items[a] != null ? (D(a, b == 1, c), y.carouselSuccessCB()) : E(function (d) {
                    if (d.items.length > 0) {
                        var e = -1;
                        a === y.currentIndex ? e = d.currentIndex : a >= y.currentIndex ? e = d.currentIndex + 1 : e = d.currentIndex - 1, y.items = d.items, D(e, b == 1, c), O()
                    }
                    y.carouselSuccessCB()
                }, function () {
                    Myspace.Confirm({
                        text: "There was a problem retrieving the photo!  Please try again.",
                        no: {
                            text: "Ok",
                            onClick: function () {}
                        },
                        yes: !1
                    }), y.carouselFailCB()
                })
            }
        }
        function D(b, c, g) {
            f.addClass("loading"), t && t.reset(), b > y.items.length - 1 ? y.currentIndex = 0 : b < 0 ? y.currentIndex = y.items.length - 1 : y.currentIndex = b, v = y.items[y.currentIndex];
            var h = new Image;
            h.onload = function () {
                f.removeClass("loading")
            }, h.src = v.urls[0].url;
            if (y.animation === "default") {
                var i = f.find("img");
                i.length > 0 ? i.attr("src", v.urls[0].url) : f.append('<img src="' + v.urls[0].url + '"/>')
            } else if (y.animation === "fade") {
                var m = a('<img src="' + v.urls[0].url + '" />'),
                    n = a('<div class="cell"></div>').append(m),
                    o = a('<div class="tbl"></div>').append(n),
                    p = a('<div class="container"></div>').css({
                        display: "none"
                    }).append(o);
                e.append(p), f = p.find(".cell"), setTimeout(function () {
                    p.fadeIn(3e3), p.prev().fadeOut(3e3, function () {
                        p.prev().remove()
                    })
                }, 1)
            }
            P() || (j.data("entityKey", v.entityKey).data("userEntityKey", v.ownerEntityKey), k.html("Photo from ").append('<a href="' + v.mixDetailUrl + '">' + v.mixTitle + "</a>"), l.html("(" + (v.albumIdIndex + 1) + " of " + v.albumIdTotalCount + ")")), !c && !P() && (K(v), L(v.photoDetailUrl), comm.send("location.href", {
                url: v.photoDetailUrl,
                photoIndex: v.albumIdIndex,
                loadState: function (a, b, c) {
                    return y.lightboxMode && d.parent().hasClass("open") || context.pfc === "PhotoDetail" ? (C(b.photoIndex, !0), !0) : !1
                }
            })), context.profileId === v.profileId ? j.hide() : j.show(), Q(v), I(), R(), g && g()
        }
        function E(b, c) {
            var d = {
                playlistId: y.playlistId,
                sortOrder: y.sortOrder
            };
            return w = !0, f.addClass("loading"), v ? (d.startingValue = v.imageId, d.startingImageKey = v.entityKey) : (d.startingValue = y.mediaId, d.startingImageKey = y.mediaEntityKey), a.ajax({
                type: "POST",
                data: d,
                url: y.fetchMoreItemsUrl
            }).done(function (a) {
                b && b(a)
            }).error(function () {
                c && c()
            }).always(function () {
                w = !1
            })
        }
        function F(b) {
            y = a.extend({}, x, b), v = null, J(y.speed), y.lightboxMode && a("body").bind("keydown", M), P() && O()
        }
        function G() {
            f.find("img").css({
                "max-width": d.width(),
                "max-height": d.height()
            })
        }
        function H() {
            d.height(q.height() - u), s.hasClass("open") ? d.width(q.width() - s.width()) : d.width(q.width())
        }
        function I() {
            H(), G()
        }
        function J(a) {
            a > 0 ? (y.speed = a, t = new Myspace.ResetTimer(function () {
                A()
            }, y.speed), t.reset()) : t && (y.speed = a, t.stop(), t = null)
        }
        function K(a) {
            comm.send("photo.view", {
                lid: context.loginId,
                iid: a.imageId,
                ek: a.entityKey,
                pid: context.beaconData.pid
            })
        }
        function L(a) {
            _gaq.push(["_trackPageview", a])
        }
        function M(a) {
            var b = a.target,
                c = a.which,
                d = b.tagName;
            if (d === "INPUT" || d === "TEXTAREA" || b.contentEditable === "true") return;
            return c == 37 ? (B(), !1) : c == 39 ? (A(), !1) : !1
        }
        function N() {
            a("body").unbind("keydown", M)
        }
        function O() {
            var a = !1,
                b = 'url("")',
                c = 'url("")',
                f = 'url("")',
                i = 'url("")';
            P() ? a = y.items.length === 1 : a = y.items.length > 0 && y.items[0].albumIdTotalCount === 1, a ? (g.hide(), m.hide(), h.hide(), n.hide(), d.unbind("hover"), e.unbind("mousemove")) : (m.show(), n.show(), window.location.search.indexOf("showFlippers") > -1 && (d.hover(function (a) {
                g.show(), h.show()
            }, function (a) {
                g.hide(), h.hide()
            }), e.mousemove(function (a) {
                a.clientX < d.width() * .5 ? (g.css("background-image", b), h.css("background-image", i), e.css("cursor", b + ", pointer")) : (h.css("background-image", f), g.css("background-image", c), e.css("cursor", f + ", pointer"))
            })))
        }
        function P() {
            return y.playlistId === 0 && y.mediaEntityKey === "" && y.mediaId === 0
        }
        function Q(a) {
            !y.isSlideShow && !P() && (a.isRailPostExpanded = y.isRailPostExpanded, comm.send(y.focusCommentTab ? "rightRail.comments" : "rightRail.info", a)), y.onScroll()
        }
        function R() {
            var a = y.items[y.currentIndex + 1] || y.items[0],
                b = y.items[y.currentIndex - 1] || y.items[y.items.length - 1];
            (new Image).src = a.urls[0].url, (new Image).src = b.urls[0].url
        }
        var d = a(b),
            e = d.find(".photoItems"),
            f = e.find(".cell"),
            g = d.children("i.prevItem"),
            h = d.children("i.nextItem"),
            i = d.find(".details"),
            j = i.find(".left > a"),
            k = i.find(".photoFrom"),
            l = i.find(".position"),
            m = i.find(".prevItem"),
            n = i.find(".nextItem"),
            o = d.find(".exit"),
            p = o.find(".tip"),
            q = a(window),
            r = a("#footer"),
            s = a("#rightRail"),
            t = null,
            u = a("#global", r).outerHeight() + a("#links", r).outerHeight(),
            v = null,
            w = !1,
            x = {
                speed: 0,
                onScroll: function (a) {},
                items: [],
                currentIndex: 0,
                mediaId: 0,
                mediaEntityKey: "",
                playlistId: 0,
                fetchMoreItemsUrl: null,
                animation: "default",
                lightboxMode: !1,
                isSlideShow: !1,
                focusCommentTab: !1,
                carouselSuccessCB: function () {},
                carouselFailCB: function () {},
                sortOrder: "NewestFirst"
            }, y = a.extend({}, x, c);
        return z(), comm.listen("spaceway.page.complete", function () {
            q.unbind("resize", I).bind("resize", I)
        }, !0), {
            moveTo: C,
            setOptions: F,
            setSpeed: J,
            unbindKeyHandler: N
        }
    }
})(jQuery);
(function (a) {
    var b = function () {
        function p(f) {
            l = window.location.pathname + window.location.search, d.find(".photoItems img").remove(), k.moveTo(f, null, function () {
                m ? (b.hide(), e.fadeIn(1e3), setTimeout(u, 3e3)) : g.css("z-index", 6), Myspace.VideoPlayer.alwaysHidden = !0, Myspace.VideoPlayer.hide(), h.addClass("media"), j.show(), a("body").bind("keydown", s)
            }), comm.send("dialog.showing", c)
        }
        function q() {
            a("body").unbind("keydown", s), k.unbindKeyHandler(), h.removeClass("media"), j.hide(), Myspace.VideoPlayer.alwaysHidden = !1, Myspace.VideoPlayer.handleShow(), m ? (r(0), comm.send("queue.clear"), b.show(), m = !1) : g.css("z-index", i)
        }
        function r(a) {
            n = a == 0, k.setSpeed(a)
        }
        function s(a) {
            var b = a.target,
                c = a.which,
                d = b.tagName;
            if (d === "INPUT" || d === "TEXTAREA" || b.contentEditable === "true") return;
            m && !n && (c == 37 || c == 39) ? v() : c == 32 && m && n && w()
        }
        function t() {
            m && n && e.fadeIn(1e3, function () {})
        }
        function u() {
            e.fadeOut(1e3, function () {})
        }
        function v() {
            r(0)
        }
        function w() {
            r(o), u()
        }
        function x(a) {
            a.lightboxMode = !0, a.animation = "fade", a.speed = o, a.isSlideShow = !0, k.setOptions(a), n = !1, m = !0, p(a.startIndex || 0)
        }
        function y(a) {
            a.lightboxMode = !0, a.animation = "default", a.speed = 0, k.setOptions(a), m = !1, p(a.startIndex || 0)
        }
        function z() {
            c.on("click", ".cell,i,img", function (a) {
                return m && !n && v(), !1
            }), f.on("click", function (a) {
                return comm.send("page.esc"), !1
            }), c.hover(t, u)
        }
        var b = a("#lightboxCover").children(),
            c = a("#photoCarouselLightbox"),
            d = c.find(".photoCarousel"),
            e = d.find(".slideShowLegend"),
            f = d.find(".exit"),
            g = a("#rightRail"),
            h = a("#lightboxCover"),
            i = g.css("z-index"),
            j = new Myspace.Dialog(c, {
                centerDialog: !1
            }),
            k = new Myspace.PhotoCarousel(d, {
                lightboxMode: !0
            }),
            l = "",
            m = !1,
            n = !1,
            o = 5e3;
        return comm.listen("dialog.hiding", function (a) {
            c[0] === a[0] && (q(), comm.send("rightRail.hide"))
        }, !0), comm.listen("photoCarousel.hide", function () {
            h.hasClass("media") && q()
        }), comm.listen("page.esc", function () {
            comm.send("location.href", {
                url: l
            })
        }, !0), z(), {
            startSlideShow: x,
            startCarousel: y
        }
    };
    Myspace.PhotoCarouselLightbox = b()
})(jQuery);
(function (a) {
    a("body").delegate("i.gifPlayBtn", "click", function (b) {
        b.preventDefault(), b.stopPropagation();
        var c = a(this),
            d = c.closest("li"),
            e = c.closest("a"),
            f = e.css("background-image"),
            g = "photoObject loading",
            h = e && a("img", e);
        if (!h) return !1;
        d.hasClass("streamItem") && (d = e, g = " loading");
        var i = h.attr("src"),
            j = i.lastIndexOf("/"),
            k, l, m = i.substr(0, j),
            n = h.attr("data-actual-size");
        return n || (n = i.substr(j + 1), h.attr("data-actual-size", n)), k = m + "/full.gif", l = m + "/" + n, c.hasClass("playing") ? (h.attr("src", l), f.indexOf("url") > -1 && (e.css("background-image", "url(" + l + ")"), h.css("opacity", "0")), c.removeClass("playing")) : (d.addClass(g), h.attr("src", k).load(function () {
            d.removeClass(g)
        }), f.indexOf("url") > -1 && (e.removeAttr("style"), h.css("opacity", "1")), c.addClass("playing")), !1
    })
})(jQuery);
(function (a) {
    function h(b) {
        function G() {
            function b(b, c) {
                var g = {
                    fileName: b.name,
                    fileSizeInBytes: b.size,
                    userFriendlyFileSize: Myspace.Upload.BytesToBiggerBytes(b.size),
                    index: c
                }, h = "superpost_selectedImage" + (f ? " dotted top" : ""),
                    i = "<div class='" + h + "'>" + "<img src='" + config.urls.emptyVideoImage + "'/>" + "<progress value='0' max='" + g.fileSizeInBytes + "'>0</progress>" + "<div class='legend'><span class='completed'>0</span> of " + g.userFriendlyFileSize + "</div>" + "<i class='close x_14'></i>" + "</div>",
                    j = function (a) {
                        t.SetPostParams({
                            uploadId: a.videoReleaseUploadId
                        }), e.attr("disabled", "disabled"), setTimeout(function () {
                            t.StartUpload()
                        }, 100)
                    }, k = function () {
                        o(g.index), n(), e.removeAttr("disabled")
                    };
                d.addClass("video").removeClass("error"), d.find(".attachments > .video").css("visibility", "hidden"), r && r.remove(), r = a(i), d.find("aside").prepend(r), r.find(".close").on("click", k), m.focus(), w = !0, a.ajax({
                    type: "POST",
                    dataType: "json",
                    data: {
                        index: c
                    },
                    url: "/ajax/manage/video/startUpload",
                    success: j
                })
            }
            function c(a, b, c) {
                r.find(".completed").text(Myspace.Upload.BytesToBiggerBytes(c)), r.find("progress").attr("value", c)
            }
            function g(a, b, c) {
                n(c.errorMessage), e.removeAttr("disabled")
            }
            function k(a, b, c) {}
            function l(a, b, c) {
                e.removeAttr("disabled"), r.find(".legend").hide().html("Upload complete.").fadeIn(), d.data({
                    "video-upload-response": c
                })
            }
            function n(a) {
                r.fadeOut(function () {
                    d.removeClass("video").find(".attachments > .video").css("visibility", "visible"), a && d.addClass("error").find(".error").text(a), r.remove()
                })
            }
            function o(b) {
                t.GetStats().in_progress ? t.CancelUpload(b) : a.save({
                    url: "/ajax/manage/video/delete",
                    method: "POST",
                    type: "POST",
                    data: {
                        videoReleaseId: d.data("video-upload-response").videoReleaseId
                    }
                })
            }
            if (r) return;
            t = new Myspace.Uploader({
                MAX_FILE_COUNT: 1,
                MEDIA_TYPE: Myspace.Upload.MEDIA_TYPES.VIDEO,
                POST_PARAMS: {
                    uploadId: 0
                },
                FILE_PROCESSED_SUCCESS_HANDLER: b,
                FILE_PROCESSED_ERROR_HANDLER: g,
                UPLOAD_PROGRESS_HANDLER: c,
                UPLOAD_ERROR_HANDLER: g,
                UPLOAD_CANCEL_HANDLER: k,
                UPLOAD_COMPLETE_HANDLER: l,
                html: {
                    filesInput: d.find("#superpostVideoFile")
                }
            }), u = function (b, c) {
                if (d.data("video-upload-response")) {
                    var e = new Date,
                        f = d.data("video-upload-response").file,
                        g = {
                            origin: "quickPost",
                            description: b,
                            title: f.substr(0, f.lastIndexOf(".")) || f,
                            releaseYear: e.getFullYear(),
                            releaseMonth: e.getMonth() + 1,
                            releaseDay: e.getDate(),
                            visibilityCode: 1,
                            videoReleaseId: d.data("video-upload-response").videoReleaseId,
                            videoCategoryId: 108,
                            thirdPartySyndication: [],
                            resultType: "video"
                        };
                    h && !j && (g.postTargetEntityKey = i), context.features.isVideosExternalPostEnabled && d.find(".thirdParties .selected").each(function () {
                        g.thirdPartySyndication.push(a(this).data("provider"))
                    });
                    var k = function () {
                        a.save({
                            url: "/ajax/manage/video/setMetadata",
                            method: "POST",
                            type: "POST",
                            data: g,
                            success: function (a) {
                                c && c(a)
                            },
                            error: function () {
                                Myspace.Error({
                                    yes: {
                                        onClick: function () {
                                            k()
                                        }
                                    }
                                })
                            }
                        })
                    };
                    k()
                }
            }, v = function (a, b) {
                var c = '<li class="video" data-video-release-id="{0}">Your video <a href="/manage/videos?vri={0}">{1}</a> is processing.<progress value="0" max="100"></progress><div class="progress">0% complete.</div></li>';
                comm.send("toasts.new", {
                    html: c.replace(/\{0\}/g, a).replace(/\{1}/g, b),
                    timeout: 864e5
                })
            }, comm.listen("videoUpload.transcoding.progress", function (b) {
                var c = a("#toasts").find('li[data-video-release-id="' + b.videoReleaseId + '"]');
                c.length && (b.progress < 100 ? (c.find("progress").val(b.progress), c.find(".progress").text(b.progress + "% complete.")) : (c.find("progress").replaceWith('<i class="endless"></i>'), c.find(".progress").text("Finalizing...")))
            }, !0), comm.listen("videoUpload.transcoding.complete", function (b) {
                var c = a("#toasts").find('li[data-video-release-id="' + b.videoReleaseId + '"]');
                c.length && setTimeout(function () {
                    comm.send("toasts.remove", c)
                }, 1e3)
            }, !0), comm.listen("videoUpload.transcoding.complete", function (a) {
                var b = d.data("video-upload-response");
                if (b && b.videoReleaseId == a.videoReleaseId) {
                    if (a.thumbnails && a.thumbnails.length) {
                        var c = a.thumbnails[0].thumbnailUrls.Thumbnail300w;
                        r.find("img").attr("src", c)
                    }
                    w = !1
                }
            }), comm.listen("videoUpload.transcoding.failed", function (a) {
                var b = d.data("video-upload-response");
                if (b && b.videoReleaseId == a.videoReleaseId) {
                    var c = "";
                    switch (a.uploadStatus) {
                        default:
                        case "ProcessingFailed":
                            c = "Video processing failed. Try another file.";
                            break;
                        case "CopyrightInfringement":
                            c = "File has been identified as copyright infringing content.";
                            break;
                        case "ProcessingFailedQA":
                            c = "Video doesn't meet minimum size criteria of 640x360. Try another file."
                    }
                    n(c)
                }
            })
        }
        function H(b) {
            var d = b.object,
                e = b.type;
            b.element && (c = a(b.element)), b && (i = b.profileKey, h = !! i, j = "profile_" + context.profileId == i, m.placeholder(b.placeholder ? b.placeholder : h ? "Write to " + (b.profileName || "") + "..." : "What's the latest?")), d && (C = d.type || e, e === "song" || e === "audio" ? S({
                entityKey: d.entityKey,
                title: d.title,
                owner: d.artistName,
                imageUrl: d.imageUrl
            }) : e === "mixtape" ? S({
                entityKey: d.entityKey,
                title: d.title,
                owner: d.owner,
                imageUrl: d.imageUrl
            }) : e === "album" ? S({
                entityKey: d.entityKey,
                title: d.title,
                owner: d.artistName,
                imageUrl: d.imageUrl
            }) : e === "video" ? S({
                entityKey: d.entityKey,
                title: d.title,
                owner: d.artistName,
                imageUrl: d.imageUrl
            }) : e === "radio" ? S({
                entityKey: d.radioStationEntityKey,
                title: d.title,
                imageUrl: d.imageUrl
            }) : e === "profile" ? S({
                entityKey: d.entityKey,
                title: d.title,
                imageUrl: d.imageUrl
            }) : e === "article" ? S({
                entityKey: d.entityKey,
                title: d.title,
                imageUrl: d.imageUrl
            }) : e === "share" && S(d))
        }
        function I(a, b, c, d) {
            var e = screen.width / 2 - b / 2,
                f = screen.height / 2 - c / 2;
            return window.open(a, d, "menubar=no,toolbar=no,status=no,width=" + b + ",height=" + c + ",toolbar=no,left=" + e + ",top=" + f)
        }
        function J() {
            A ? K() : a.ajax({
                url: "/ajax/thirdparty/connections",
                type: "POST",
                success: function (a) {
                    A = a, K()
                }
            })
        }
        function K() {
            A.twitter && a(".superpostTwitter", d).addClass("connected"), A.facebook && a(".superpostFacebook", d).addClass("connected"), a(".thirdParties li", d).click(function () {
                var b = a(this);
                if (b.hasClass("connected")) {
                    b.toggleClass("selected");
                    return
                }
                if (E) return;
                E = b;
                var c = b.data("provider");
                return a.ajax({
                    url: "/ajax/thirdpartyauth/connecttoken",
                    type: "POST",
                    success: function (a) {
                        var b = "/thirdpartyauth/" + c + "/superpost?mstoken=" + a.token;
                        D = I(b, 800, 800, "Third Party Authentication");
                        var d = setInterval(function () {
                            if (!D || D.closed) clearInterval(d), comm.send("thirdParty.supperpostRejected", {
                                    additionalData: {
                                        msg: "Access to " + c + " rejected."
                                    }
                                }), D.closed = !0
                        }, 1e3)
                    }
                }), !1
            })
        }
        function L() {
            z ? Q(z, !0) : a.ajax({
                url: "/ajax/geoiplookup",
                type: "POST",
                success: function (a) {
                    z = a, Q(a, !0)
                }
            })
        }
        function M(a) {
            d.removeClass("attaching location photo video share posting error message songtrigger"), d.removeData(), e.removeAttr("disabled"), m.reset(), n.text(""), p && p.remove(), o && (o.val(""), L()), q && (q.val(""), B.removeClass("post_photo user_16").addClass("post_song"), C = null), a && H(a), g && d.addClass("minimized"), r && (r.remove(), d.find(".attachments > .video").css("visibility", "visible"))
        }
        function N(b, c) {
            x || (x = window.FileReader ? new FileReader : null), d.addClass("attaching photo").removeClass("share songtrigger"), p && p.remove();
            var e = "superpost_selectedImage";
            f && (e += " dotted top"), p = a("<div class='" + e + "'></div>"), d.find("aside").prepend(p), x ? (p.addClass("loading"), x.onload = function (b) {
                p.append(a("<img src='" + b.target.result + "'/>")).removeClass("loading")
            }, x.readAsDataURL(b)) : p.addClass("noImage").append("<p><strong>Attached:</strong> " + b.name + "</p>"), p.append(a("<i></i>").addClass("x_14").click(function () {
                s.CancelUpload(c), p.remove(), d.removeClass("photo")
            })), m.focus()
        }
        function O(a, b, c) {
            d.removeClass("posting"), e.removeAttr("disabled"), Z("Error occurred. Please try again : " + c.errorMessage)
        }
        function P(a, b, c) {
            V(c)
        }
        function Q(b, c, e) {
            var g;
            o || (o = d.find(".superpost_location"), g = templates["common/views/generic/superpost/_location"], Myspace.AutoComplete(o, {
                handlerUrl: "/ajax/geosearch",
                template: g,
                interval: 500,
                minlen: 5,
                onSelectItem: function (b) {
                    var c = a(b),
                        d = c.text().trim();
                    o.attr("data-entity-key", c.attr("data-entity-key")).attr("data-val", d).val(d)
                },
                sessionRequired: !0
            }), o.blur(function () {
                var a = o.val().trim();
                a != o.attr("data-val") && o.attr("data-entity-key", ""), a == "" && d.removeClass("location")
            }).siblings("i").click(function () {
                return o.val("").attr("data-entity-key", ""), d.removeClass("location"), !1
            })), b && o.attr("data-entity-key", b.entityKey).attr("data-val", b.locationNameWithHierarchy).val(b.locationNameWithHierarchy);
            if (f && e && e.target.className === "post_location" && d.hasClass("location")) {
                d.removeClass("location");
                return
            }
            d.addClass("attaching location"), c || o.focus()
        }
        function R(b) {
            var c = templates["common/views/generic/superpost/_song"];
            q || (q = d.find(".superpost_song"), Myspace.AutoComplete(q, {
                handlerUrl: "/ajax/autocomplete/songs?max=10",
                template: c,
                interval: 500,
                minlen: 2,
                fitToElement: !0,
                onGetDataSuccessfully: function (a, b) {
                    comm.send("player.nowPlaying", function (c) {
                        c && c.mediaItem && c.mediaItem.songId && (c.mediaItem.nowPlaying = !0, a.unshift(c.mediaItem)), b(a)
                    })
                },
                onSelectItem: function (b) {
                    b = a(b), S({
                        entityKey: b.attr("data-entity-key"),
                        title: b.find("h6").text(),
                        owner: b.find("p").text(),
                        imageUrl: b.find("img").attr("src").replace("70x70", "300x300")
                    })
                },
                customClass: "slats small",
                sessionRequired: !0
            }), d.find(".superpost_shareContainer").click(function (a) {
                a.stopPropagation()
            }), f && (q.siblings("i").click(function () {
                return q.val(""), d.removeClass("songtrigger"), !1
            }), q.blur(function () {
                q.val().trim() == "" && setTimeout(function () {
                    d.removeClass("songtrigger")
                }, 100)
            })));
            if (f) {
                if (b && b.target.className == "post_song" && (d.hasClass("songtrigger") || d.hasClass("share"))) {
                    q.val(""), d.removeClass("songtrigger share");
                    return
                }
                d.hasClass("share") || d.addClass("songtrigger").removeClass("photo")
            }
            q.focus()
        }
        function S(a) {
            if (!a.entityKey) return;
            q || R(), y || (y = require("ejs").compile(templates["common/views/generic/superpost/_share"]), B = d.find("i.post_song")), f || (a.inline = !0), d.find(".superpost_shareContainer").html(y(a)).attr("data-entity-key", a.entityKey).find("i").click(function () {
                d.find(".superpost_shareContainer").html(""), d.removeClass("share"), q.val("").focus(), B.removeClass("post_photo user_16 trending_16").addClass("post_song"), C = null
            }), d.removeClass("songtrigger").addClass("attaching share"), m.focus(), C === "profile" ? B.removeClass("post_song").addClass("user_16") : C === "photo" ? B.removeClass("post_song").addClass("post_photo") : C === "article" && B.removeClass("post_song").addClass("trending_16")
        }
        function T() {
            if (d.hasClass("photo")) {
                var b = W();
                a.ajax({
                    url: "/ajax/stream/mslink",
                    type: "POST",
                    data: {
                        data: b
                    },
                    success: function (a) {
                        a.out && (b = a.out)
                    },
                    complete: function () {
                        U(b)
                    }
                }), d.addClass("posting"), e.attr("disabled", "disabled");
                return
            }
            if (d.hasClass("video")) {
                d.addClass("posting"), e.attr("disabled", "disabled");
                var b = W();
                a.ajax({
                    url: "/ajax/stream/mslink",
                    type: "POST",
                    data: {
                        data: b
                    },
                    success: function (a) {
                        a.out && (b = a.out)
                    },
                    complete: function () {
                        u(b, function (a) {
                            X();
                            if (w) {
                                var b = a && a.video && a.video.videoReleaseId;
                                Myspace.Confirm({
                                    yes: {
                                        text: "Continue",
                                        onClick: function () {
                                            context.pfc !== "manageVideos" ? b && v(b, a.video.title) : comm.send("location.href", "/manage/videos?vri=" + b)
                                        }
                                    },
                                    no: {
                                        text: "Edit Video Info",
                                        onClick: function () {
                                            comm.send("location.href", "/manage/videos?vri=" + b)
                                        }
                                    },
                                    text: '<span style="white-space: nowrap;">Your video is processing. We will send<br/>you a notification when it\'s ready to view.</span>',
                                    beforeShow: function (a) {
                                        a.$root.css({
                                            width: "auto",
                                            "max-width": "960px"
                                        })
                                    }
                                })
                            }
                        })
                    }
                });
                return
            }
            V()
        }
        function U(a) {
            var b, c;
            d.hasClass("location") && (b = o.attr("data-entity-key")), h && (c = i);
            if (a || h || b) a && a.charAt(0) === '"' && a.charAt(a.length - 1) === '"' && (a += " "), s.SetPostParams({
                    location: b,
                    target: c,
                    caption: a
                });
            s.StartUpload()
        }
        function V(b) {
            var f = !0,
                g = W(),
                j = d.hasClass("share"),
                k = {}, l, m;
            b && (l = b.imageEntityKey, m = b.activityEntityKey), g && (k.comment = g, f = !1), d.hasClass("location") && (k.locationentitykey = o.attr("data-entity-key"));
            if (j) {
                var n = d.find(".superpost_shareContainer").attr("data-entity-key");
                n ? (k.songentitykey = n, f = !1) : j = !1
            }
            l && (k.imageentitykey = l, m && (k.imageUploadActivityKey = m), f = !1);
            if (f) {
                Z("Can not post empty status");
                return
            }
            h && (k.targetKey = i), d.find(".thirdParties .selected").each(function () {
                k[a(this).data("provider")] = 1
            }), comm.send("influencer.click", c), a.ajax({
                url: "/ajax/stream/superpost",
                type: "POST",
                data: k,
                success: X,
                error: Y
            }), d.addClass("posting"), e.attr("disabled", "disabled");
            var p = new Tracking("POST", j ? "Share" : l ? "Photo" : "Update");
            comm.send("track", p)
        }
        function W() {
            var a = m.val().trim(),
                b = m.getMentions();
            return b && Object.keys(b).forEach(function (c) {
                var d = b[c];
                a = a.replace("[[" + d.text + "]]", "[@" + d.userName + "|" + d.key + "]")
            }), a
        }
        function X(a) {
            comm.send("superpost.onPost", {
                err: null,
                el: c,
                data: a,
                isProfilePost: h
            }), d.removeClass("posting"), e.removeAttr("disabled"), _("Succesfully posted the status."), g && M()
        }
        function Y(a, b, f) {
            Z(f || b), d.removeClass("posting"), e.removeAttr("disabled"), comm.send("superpost.onPost", {
                err: {
                    status: a.status,
                    message: f || b
                },
                el: c
            })
        }
        function Z(a) {
            n.text(a), d.addClass("error")
        }
        function _(a) {
            n.text(a), d.addClass("message")
        }
        var c, d = a(b.container),
            e = d.find("button.primary"),
            f = d.hasClass("inline"),
            g = d.hasClass("minimized"),
            h, i, j, k = context.features.isMentionProfileEnabled,
            l = {
                maxLength: 1024,
                showCount: !0,
                showUrlCutOffWarning: !0
            }, m, n = d.find(".error"),
            o, p, q, r, s, t, u, v, w = !0,
            x, y, z, A, B, C, D = null,
            E = null;
        g && (l.focus = function () {
            d.removeClass("minimized")
        }), m = Myspace.postControl(k ? d.find(".postControl > div[contenteditable]") : d.find(".postControl textarea"), l);
        if (!m) {
            var F = require("ejs").compile(templates["common/views/generic/postcontrol"]);
            d.find(".postControl").html(a(F(b)).html()), m = Myspace.postControl(k ? d.find(".postControl > div[contenteditable]") : d.find(".postControl textarea"), l)
        }
        return H(b), J(), L(), s = new Myspace.LiteUploader({
            MEDIA_TYPE: Myspace.Upload.MEDIA_TYPES.STREAM,
            FILE_PROCESSED_SUCCESS_HANDLER: N,
            UPLOAD_ERROR_HANDLER: O,
            UPLOAD_COMPLETE_HANDLER: P,
            html: {
                filesInput: d.find("input[name=superpostPhotoFile]")
            }
        }), comm.listen("thirdParty.superpost", function () {
            A[E.data("provider")] = !0, E.addClass("connected selected"), E = null
        }), comm.listen("thirdParty.superpostRejected", function (a) {
            E = null, Myspace.Error({
                text: a.additionalData.msg || "Oops, something went wrong and we were unable to get your connections. Please try again later.",
                yes: {
                    text: "OK"
                },
                no: !1,
                closeAll: !1
            })
        }), e.click(T), d.find(".attachments li").click(function (b) {
            var c = a(this);
            c.hasClass("song") ? R(b) : c.hasClass("location") ? Q(null, !0, b) : c.hasClass("video") && G()
        }), d.attr("data-wired", !0), {
            getElement: function () {
                return c
            },
            setElement: function (b) {
                c = a(b)
            },
            reset: function (a) {
                M(a)
            },
            focus: function () {
                m.focus()
            }
        }
    }
    var b, c, d, e, f, g;
    comm.listen("superpost", function (i) {
        if (!Myspace.User.isLoggedIn) return comm.send("login.prompt", {
                action: "share",
                object: i && i.object && i.object.entityKey
            });
        var j = a(i.element),
            k = a(i.container),
            l = context.features.isMentionProfileEnabled,
            m;
        if (k.length && k.hasClass("superpost")) {
            k.attr("data-wired") || h(i).focus();
            return
        }
        b && e != l && (b = null), b ? c.reset(i) : (e = l, m = a("#superpostDialog"), b = new Myspace.Dialog(m, {
            closeAll: !1
        }), i.container = m, c = h(i), f || (f = !0, comm.listen("superpost.onPost", function (a) {
            !a.err && a.el[0] === c.getElement()[0] && setTimeout(function () {
                b.hide()
            }, 0)
        }, !0), comm.listen("dialog.hiding", function (b) {
            b.attr("id") === "superpostDialog" && (c.reset(), a("#lightboxCover").css("z-index", d), g && (comm.send("location.href", {
                url: g,
                loadState: function () {
                    return !0
                }
            }), g = null))
        }, !0)), d = a("#lightboxCover").css("z-index")), b.show(!0), c.focus(), a("#lightboxCover").css("z-index", 5), comm.send("track", new Tracking("POST", "Invoke", i.type)), g = location.href, comm.send("location.href", {
            url: "/post",
            loadState: function (a, b, c) {
                return !0
            }
        }), context.beaconData.pf = "postoverlay", comm.send("beacon", context.beaconData)
    }, !0)
})(jQuery);
(function (a) {
    Myspace.Flippers = function (b, c) {
        function j() {
            d[0].clientWidth < d[0].scrollWidth ? (d[0].scrollLeft === 0 ? c.hide(e) : c.show(e), d[0].scrollLeft === d[0].scrollWidth - d[0].clientWidth ? c.hide(f) : c.show(f)) : (c.hide(e), c.hide(f))
        }
        function k(a) {
            g && clearInterval(g), g = setInterval(function () {
                d[0].scrollLeft = d[0].scrollLeft + (a === "right" ? 20 : -20)
            }, 40)
        }
        function l() {
            clearInterval(g)
        }
        function m(a) {
            d.off("scroll", n), d = a, d.on("scroll", n)
        }
        function n(a) {
            h && clearTimeout(h), h = setTimeout(function () {
                l(), j()
            }, 200)
        }
        c = a.extend({
            hide: function (a) {
                a.fadeOut()
            },
            show: function (a) {
                a.fadeIn()
            }
        }, c);
        var d = a(b),
            e = c.leftFlipper ? a(c.leftFlipper) : d.parent().find(".leftFlipper"),
            f = c.rightFlipper ? a(c.rightFlipper) : d.parent().find(".rightFlipper"),
            g = null,
            h = null,
            i = null;
        return d.on("scroll", n), a(window).resize(function (a) {
            i && clearTimeout(i), i = setTimeout(function () {
                j()
            }, 200)
        }), f.mousedown(function () {
            k("right")
        }).mouseup(l), f.on("mousedown touchstart", function () {
            k("right")
        }).on("mouseup touchend", function () {
            l()
        }), e.on("mousedown touchstart", function () {
            k("left")
        }).on("mouseup touchend", function () {
            l()
        }), j(), {
            moveScroll: k,
            stopScroll: l,
            toggleFlippers: j,
            setElm: m
        }
    }
})(jQuery);
(function () {
    Myspace.FooterPopout = function (a, b) {
        function d() {
            a.addClass("open"), a.css("display", "block"), clearTimeout(c), comm.listen("page.esc", f), setTimeout(function () {
                $(document).on("click", e)
            }, 0)
        }
        function e(b) {
            var c = $(b.target);
            a.find(c).length === 0 && c.closest("#hCard").length === 0 && f()
        }
        function f() {
            a.removeClass("open"), c = setTimeout(function () {
                a.css("display", "none")
            }, 200), comm.stopListening("page.esc", f), $(document).off("click", e), b.onClose && b.onClose()
        }
        function g() {
            var b = a.hasClass("open");
            return b ? f() : d(), !b
        }
        b = b || {};
        var c;
        return a.find(".actionBar > .close").click(function () {
            f()
        }), comm.listen("spaceway.page.complete", f, !0), comm.listen("player.onClick", f, !0), {
            open: d,
            close: f,
            toggle: g
        }
    }
})();
(function (a) {
    function i() {
        d.find(".notification.unviewed").removeClass("unviewed")
    }
    function k() {
        if (!j) return j = !0, d.empty(), c.addClass("loading white"), h = !0, l().done(function (a) {
                a.totalRecords > 0 && a.html ? (m(a.html), o()) : b.addClass("noResults")
            }).fail(function () {
                b.addClass("noResults")
            }).always(function () {
                j = !1, c.removeClass("loading white")
            })
    }
    function l() {
        return a.ajax({
            url: "/ajax/notifications",
            type: "POST",
            data: {
                start: 0,
                max: 10
            }
        })
    }
    function m(c) {
        var e = a(c);
        d.prepend(e), b.removeClass("noResults"), comm.send("page.changed", d)
    }
    function n(a) {
        a.html && m(a.html), p(a.counts)
    }
    function o() {
        Myspace.Notifications.markAsViewed(d.find(".notification.unviewed"))
    }
    function p(a) {
        a && f.text(a.unseen).toggleClass("empty", a.unseen === 0)
    }
    var b = a("#notificationsPopout"),
        c = b.children("section"),
        d = b.find(".notifications"),
        e = a("#showNotificationsNavLink"),
        f = e.find(".count"),
        g = new Myspace.FooterPopout(b, {
            onClose: i
        }),
        h = !0;
    Myspace.Notifications.wireList(d, !0), e.click(function (b) {
        var c = a('.tip[data-name="notifications"]'),
            d = g.toggle();
        d ? (c.hide(), f.addClass("empty").text(""), h ? o() : k()) : c.show(), b.preventDefault()
    });
    var j = !1;
    comm.listen("notifications.removed", function () {
        d.find(".notification").length || k()
    }, !0), comm.listen("notifications.count", p, !0), comm.listen("notifications.new.render", n, !0)
})(jQuery);
(function (a) {
    function b() {
        function m(a) {
            n(), e.addClass("loading"), j.val(a.entityKey), Myspace.MessagingManager.getMediaHtml(a.entityKey).done(function (a) {
                e.html(a)
            }).always(function () {
                e.removeClass("loading")
            }), comm.send("drawer.panel", "messaging"), comm.send("drawer.open"), b.addClass("open"), h.focus()
        }
        function n() {
            l.clearCache(), l.hideList(), i.val(""), h.val(""), k.val(""), e.html(""), g.prop("disabled", !0)
        }
        function o() {
            b.removeClass("open")
        }
        function p(a, b, c) {
            Myspace.MessagingManager.getOnlineUsers(function (d, e) {
                if (d) return c(d);
                var f = [],
                    g = new RegExp(a, "i");
                e.forEach(function (a) {
                    (g.test(a.name) || g.test(a.username)) && f.push(a)
                }), b({
                    data: f
                })
            })
        }
        var b = a("#messagePopout"),
            d = b.find("form"),
            e = d.find(".messageMedia"),
            f = d.find(".message"),
            g = d.find("button[type=submit]"),
            h = d.find("input[name=search]"),
            i = d.find("textarea[name=message]"),
            j = d.find("input[name=media]"),
            k = d.find("input[name=recipient]"),
            l;
        return d.submit(function () {
            o();
            var a = k.val(),
                b = j.val(),
                c = i.val(),
                d = e.html();
            return comm.send("instantmessage.send", {
                toEntity: a,
                message: c,
                mediaEntityKey: b,
                mediaHtml: d
            }), comm.send("instantmessage.open", {
                entityKey: a
            }), !1
        }), l = Myspace.AutoComplete(b.find("input[name=search]"), {
            dataHandler: p,
            template: c,
            interval: 500,
            minlen: 2,
            onSelectItem: function (b) {
                var c = a(b).data();
                h.val(c.name), k.val(c.entityKey), g.prop("disabled", !1)
            },
            onSelectionModified: function () {
                k.val(""), g.prop("disabled", !0)
            },
            noResultsMessage: "No online friends found."
        }), b.find(".close").click(o), i.focus(function () {
            f.addClass("focused")
        }).blur(function () {
            f.removeClass("focused")
        }), {
            open: m,
            close: o
        }
    }
    var c = '<% locals.forEach(function(user) { %><li data-name="<%= user.name %>" data-entity-key="<%- user.entityKey %>"><%= user.name %></li><% }); %>',
        d;
    comm.listen("messaging.popout", function (a) {
        d = d || new b, d.open(a)
    }, !0)
})(jQuery);
(function (a) {
    function h(b) {
        var c = Myspace.MessagingManager.getSettings(),
            d = !c[b],
            e = c.objectVersion,
            f = g[b];
        return f.toggleClass("on", d), a.save({
            url: "/ajax/instantmessage/settings/" + b,
            data: {
                value: d,
                objectVersion: e
            }
        }).done(function (a) {
            b === "IsIMEnabled" && comm.send("presence.sethidden", !d), Myspace.MessagingManager.setSettings(a), scomm.send("messaging.setting", {
                name: b,
                setting: a
            })
        }).fail(function () {
            f.toggleClass("on", c[b])
        })
    }
    var b = a("#messagingLink"),
        c = a("#messaging").children(".horizontal"),
        d = b.find(".count"),
        e = a("#isIMEnabled"),
        f = a("#isIMSoundEnabled"),
        g = {
            IsIMEnabled: e,
            IsIMSoundEnabled: f
        };
    b.click(function (a) {
        comm.send("drawer.togglePanel", "messaging"), a.preventDefault()
    }), comm.listen("messaging.unreadcount", function (a) {
        var b = d.data("count") + a;
        d.toggleClass("empty", b === 0).text(b).data("count", b)
    }, !0), scomm.add(function (a, b) {
        if (a === "messaging.setting") {
            var c = b.name,
                d = b.setting,
                e = g[c];
            e.toggleClass("on", d[c]), Myspace.MessagingManager.setSettings(d)
        }
    }), comm.listen("drawer.panel", function (a) {
        a === "messaging" && c.scrollLeft(0)
    }, !0), comm.listen("messaging.togglesetting", function (a) {
        h(a.settingName, a.$toggle)
    }, !0)
})(jQuery);
(function (a) {
    function i(g, h) {
        function t(c) {
            var e = a(b.render(d, c));
            e.find(".close").click(function () {
                return comm.send("instantmessage.close", {
                    entityKey: g
                }), o("closeChat"), !1
            }), e.find(".minimize").click(function () {
                return comm.send("instantmessage.minimize", {
                    entityKey: g
                }), o("minimizeChat"), !1
            });
            var f = null;
            return e.find("input[name=message]").keypress(function (a) {
                if (a.which !== 13) {
                    var b = new Date;
                    b - f > 1e4 && (f = b, p.sendTypingIndicator(g))
                }
            }), e.find("form").submit(function (b) {
                function h() {
                    f = null, comm.send("instantmessage.send", g)
                }
                b.preventDefault(), b.stopPropagation();
                var d = a(this).find("input[name=message]"),
                    e = a.trim(d.val()),
                    g = {
                        toEntity: c.entityKey,
                        toProfileId: c.profileId,
                        message: e
                    };
                if (!e) return;
                h()
            }), Myspace.DragDrop.addDroppables(e), e
        }
        function u() {
            s || (j = t(h).addClass(r), k = j.find(".messages"), l = j.find("input[name=message]"), m = a(b.render(f, {
                imgUrl: h.imgUrl
            })), n = a('<div class="typing loading white"></div>'), s = !0)
        }
        function v() {
            k.scrollTop(k.prop("scrollHeight"))
        }
        function w() {
            var a = 50;
            return k.innerHeight() + k.scrollTop() + a >= k.prop("scrollHeight")
        }
        function y(c) {
            u();
            if (x[c.messageId]) return;
            x[c.messageId] = c.messageId;
            var d = c.fromEntity,
                f = d === "profile_" + context.profileId,
                g = w() && q,
                j = new Date,
                m = a.extend({
                    timestamp: z(j),
                    isSelf: f
                }, c),
                n = m.mediaHtml;
            !n && m.mediaEntityKey && (n = p.getMediaHtml(m.mediaEntityKey)), a.when(n).done(function (c) {
                m.mediaHtml = c, f ? (m.imgUrl = context.profileImage, m.profileId = context.profileId, l.val("")) : (m.imgUrl = h.imgUrl, m.profileId = h.profileId);
                var j = a(b.render(e, m));
                i === d ? (j = j.find(".message").children(), k.find("> .messageGroup:not(.typingIndicator)").last().find("> .message").append(j)) : k.append(j), g && v(), i = d
            })
        }
        function z(a) {
            var b = a.getHours(),
                c = a.getMinutes(),
                d = b >= 12,
                e = d ? "pm" : "am";
            return b = d ? b - 12 : b, b === 0 && (b = 12), c = c < 10 ? "0" + c : c, b + ":" + c + e
        }
        function A() {
            u(), q = !0, c.prepend(j), j.addClass("open").find("input").focus(), v()
        }
        function B() {
            q = !1, j.removeClass("open"), j.detach()
        }
        function C() {
            s && j.addClass("online").removeClass("offline idle"), r = "online"
        }
        function D() {
            s && j.addClass("offline").removeClass("online idle"), r = "offline"
        }
        function E() {
            s && j.addClass("idle").removeClass("online offline"), r = "idle"
        }
        function H() {
            u();
            if (!G) {
                var a = w(),
                    b = h.entityKey;
                i === b ? k.find("> .messageGroup:last-child > .message").append(n) : k.append(m), a && v()
            }
            F.reset(), G = !0
        }
        function I() {
            u(), F.stop(), m.detach(), n.detach(), G = !1
        }
        var i = null,
            j, k, l, m, n, q = !1,
            r = "online",
            s = !1,
            x = {}, F = new Myspace.ResetTimer(I, 15e3),
            G = !1;
        this.addMessage = y, this.open = A, this.close = B, this.goOnline = C, this.goOffline = D, this.goIdle = E, this.showTypingIndicator = H, this.hideTypingIndicator = I
    }
    function k(c, d) {
        function k() {
            i !== "active" && t("online"), e.removeClass("offline idle").addClass("online"), g = "online"
        }
        function l() {
            i !== "active" && t("offline"), e.removeClass("online idle").addClass("offline"), g = "offline"
        }
        function m() {
            i !== "active" && t("idle"), e.removeClass("online offline").addClass("idle"), g = "idle"
        }
        function n() {
            e.addClass("open"), t("active"), r(0), f = !0
        }
        function p() {
            e.removeClass("open"), t(g), f = !1
        }
        function q() {
            e.removeClass("open"), f = !1
        }
        function r(a) {
            e.find(".count").text(a).toggleClass("empty", a === 0)
        }
        function s(a) {
            t("active"), r(a)
        }
        function t(a) {
            if (a !== i) {
                var b = j[a];
                if (i) {
                    var c = j[i];
                    e.detach(), c.children().length || c.removeClass("hasChildren")
                }!i || a === "active" || i === "idle" && a === "online" ? b.append(e) : b.prepend(e), b.addClass("hasChildren"), i = a
            }
        }
        function u() {
            return i
        }
        var e = a(b.render(h, d)),
            f = !1,
            g = null,
            i = null;
        e.click(function () {
            var a = e.parent("ul");
            return o("openChat", a.hasClass("active") ? "active" : a.hasClass("online") ? "online" : "offline"), comm.send("instantmessage.open", {
                entityKey: c,
                userData: d
            }), !1
        }), this.goOnline = k, this.goOffline = l, this.goIdle = m, this.open = n, this.close = p, this.minimize = q, this.receiveMessage = s, this.getStatus = u
    }
    function l(b, c, d, e) {
        return a.ajax({
            type: "POST",
            url: "/ajax/instantmessage/send",
            data: {
                toEntity: b,
                message: c,
                messageId: d,
                mediaEntityKey: e
            }
        })
    }
    function m(c, d) {
        function r(c, d, e, f) {
            var h = d || "";
            h = h.length > 65 ? h.substring(0, 65) + "..." : h;
            var i = a.extend({
                message: h,
                mediaHtml: f
            }, e);
            comm.send("toasts.new", {
                html: b.render(g, i),
                onAdd: function (a) {
                    a.on("click", function () {
                        comm.send("drawer.open", "messaging"), comm.send("instantmessage.open", {
                            entityKey: c
                        })
                    })
                }
            })
        }
        var e = new i(c, d),
            f = new k(c, d),
            h = 0,
            j = 0,
            m = !1,
            n = !1,
            q = this;
        this.goOnline = function () {
            n = !0, e.goOnline(), f.goOnline()
        }, this.goOffline = function () {
            n = !1, e.goOffline(), f.goOffline()
        }, this.goIdle = function () {
            n = !0, e.goIdle(), f.goIdle()
        }, this.setPresence = function (a) {
            switch (a) {
                case "Online":
                    this.goOnline();
                    break;
                case "Idle":
                    Date.now() - j >= 12e4 && this.goIdle();
                    break;
                default:
                    this.goOffline()
            }
        }, this.open = function () {
            m = !0, e.open(), f.open(), h !== 0 && comm.send("messaging.unreadcount", -1), h = 0
        }, this.close = function () {
            m = !1, e.close(), f.close()
        }, this.minimize = function () {
            m = !1, e.close(), f.minimize()
        }, this.receiveMessage = function (b) {
            j = Date.now();
            var c = "";
            b.mediaEntityKey && (c = p.getMediaHtml(b.mediaEntityKey)), a.when(c).done(function (a) {
                var c = f.getStatus() !== "active";
                m || (h === 0 && comm.send("messaging.unreadcount", 1), h++, f.receiveMessage(h), r(b.fromEntity, b.message, d, a)), q.goOnline(), b.mediaHtml = a, e.addMessage(b), e.hideTypingIndicator(), comm.send("messaging.messagereceived", {
                    user: d,
                    isNewConversation: c
                })
            })
        }, this.sendMessage = function (b) {
            function c() {
                o("sendMessage");
                var c = a.trim(b.message),
                    f = Myspace.Utils.guid();
                b.fromEntity = "profile_" + context.profileId, b.messageId = f, e.addMessage(b), scomm.send("instantmessage.sent", b), l(d.entityKey, c, f, b.mediaEntityKey)
            }
            var f = p.getSettings().IsIMEnabled;
            f ? c() : Myspace.Confirm({
                text: "You are offline. Would you like to go online to send a message?",
                yes: {
                    onClick: function () {
                        return comm.send("messaging.togglesetting", {
                            settingName: "IsIMEnabled",
                            $toggle: a("#isIMEnabled")
                        }), c(), !1
                    }
                }
            })
        }, this.isOpen = function () {
            return m
        }, this.isOnline = function () {
            return n
        }, this.showTypingIndicator = function () {
            j = Date.now(), q.goOnline(), e.showTypingIndicator()
        }, this.addMessage = function (a) {
            e.addMessage(a)
        }, this.entityKey = c, this.user = d
    }
    function n() {
        function e(c, e, f) {
            var g = b[c];
            g ? e(g) : (f || (d[c] ? f = d[c] : d[c] = f = a.ajax({
                url: "/ajax/instantmessage/initiate",
                type: "POST",
                data: {
                    entityKey: c
                }
            })), a.when(f).then(function (a) {
                delete d[c], g = b[c], g || (b[c] = g = new m(c, a), g.setPresence(a.presence)), e(g)
            }))
        }
        function f(a) {
            var d = b[a];
            d.isOpen() || (c && c.minimize(), d.open(), c = d)
        }
        function g(a) {
            var d = b[a];
            d.minimize(), c = null
        }
        function h(a) {
            var d = b[a];
            d.close(), c = null
        }
        function i(a) {
            var b = a.toEntity;
            e(b, function (b) {
                b.addMessage(a)
            })
        }
        function l() {
            j || (j = !0, comm.stopListening("drawer.panel", n));
            var c = Object.keys(b).map(function (a) {
                var c = b[a];
                return c.user.profileId
            }),
                d = {
                    loaded: c,
                    presence: Myspace.Presence.getCurrentPresence(),
                    client: "web"
                };
            return a.ajax({
                url: "/ajax/instantmessage/onlinenow",
                type: "POST",
                data: d
            }).done(function (a) {
                for (var c in b) {
                    var d = !1;
                    a.users.forEach(function (a) {
                        a.entityKey === c && (d = !0)
                    });
                    if (!d) {
                        var f = b[c];
                        f.goOffline()
                    }
                }
                a.users.forEach(function (a) {
                    e(a.entityKey, function (b) {
                        b.setPresence(a.presence)
                    }, a)
                })
            })
        }
        function n(a) {
            a === "messaging" && l()
        }
        function r() {
            a(window).focus(function () {
                q = !0, comm.send("title.stopflashing"), scomm.send("title.stopflashing")
            }).blur(function () {
                q = !1
            })
        }
        function s(a) {
            function c() {
                var a = [];
                return Object.keys(b).forEach(function (c) {
                    var d = b[c];
                    d.isOnline() && a.push(d.user)
                }), a
            }
            if (j) {
                var d = c();
                a(null, d)
            } else l().done(function () {
                    var b = c();
                    a(null, b)
                }).fail(a)
        }
        function u() {
            return t
        }
        function v(b) {
            a.extend(t, b)
        }
        function w(b) {
            return a.ajax({
                url: "/ajax/instantmessage/mediadetails",
                type: "POST",
                data: {
                    mediaEntityKey: b
                }
            })
        }
        function x(b) {
            return a.ajax({
                url: "/ajax/instantmessage/typing",
                type: "POST",
                data: {
                    toEntity: b
                }
            })
        }
        var b = {}, c, d = {};
        comm.listen("instantmessage.sent", i, !0), scomm.add(function (a, b) {
            if (a !== "instantmessage.sent") return;
            i(b)
        }), comm.listen("instantmessage.send", function (a) {
            e(a.toEntity, function (b) {
                b.sendMessage(a)
            })
        }, !0), comm.listen("instantmessage.open", function (a) {
            var b = a.entityKey,
                c = a.userData;
            e(b, function (a) {
                f(a.entityKey)
            }, c)
        }, !0), comm.listen("instantmessage.close", function (a) {
            var b = a.entityKey;
            h(b)
        }, !0), comm.listen("instantmessage.minimize", function (a) {
            var b = a.entityKey;
            g(b)
        }, !0), comm.listen("instantmessage.new", function (a) {
            var b = a.fromEntity;
            e(b, function (b) {
                b.receiveMessage(a)
            })
        }, !0), comm.listen("instantmessage.typing", function (a) {
            var b = a.fromEntity;
            e(b, function (a) {
                a.showTypingIndicator()
            })
        }, !0);
        var j = !1,
            k = 3e4;
        setTimeout(l, 2e3), setInterval(l, k), comm.listen("drawer.panel", n, !0);
        var o = document.getElementById("newIMAudio"),
            p = document.getElementById("newIMConversationAudio");
        comm.listen("messaging.messagereceived", function (a) {
            if (!q) {
                var b = a.user.name + " sent you a message...";
                comm.send("title.startflashing", b)
            }
            u().IsIMSoundEnabled && (a.isNewConversation ? (p.currentTime = 0, p.volume = .2, p.play()) : (o.currentTime = 0, o.play()))
        }, !0);
        var q = !1;
        r(), comm.listen("spaceway.page.complete", r, !0);
        var t = context.messaging.settings;
        return {
            getOnlineUsers: s,
            getSettings: u,
            setSettings: v,
            sendTypingIndicator: x,
            getMediaHtml: w
        }
    }
    function o(a, b) {
        comm.send("track", new Tracking("playerMessaging", a, b))
    }
    function q() {
        p = Myspace.MessagingManager = new n
    }
    var b = require("ejs"),
        c = a("#messageBar"),
        d = '<div class="chat popout" data-dest="sendinstantmessage" data-entity-key="<%- locals.entityKey %>"><header><a href="/<%- locals.username.toLowerCase() %>"><%= locals.name %></a><div class="actionBar"><i class="minimize"></i><i class="close"></i></div></header><section><div class="messages"></div><p class="offlineMessage"><%= locals.name %> is offline and can\'t receive messages.</p><form><input type="text" autocomplete="off" placeholder="Enter message..." name="message"/></form></section></div>',
        e = '<div class="messageGroup <%- locals.isSelf ? "self" : "" %>" data-influencer="<%- locals.profileId %>"><div class="sender"><img src="<%- locals.imgUrl %>" /></div><div class="message"><div><% if(locals.message) { %><span><%= locals.message %></span><% }%><% if(locals.mediaHtml) { %><div class="messageMedia"><%- locals.mediaHtml %></div><% } %><time><%- locals.timestamp %></time></div></div></div>',
        f = '<div class="messageGroup typingIndicator"><div class="sender"><img src="<%- locals.imgUrl %>" /></div><div class="message typing"><div class="typing loading white"></div></div></div>',
        g = '<li class="instantMessage" data-influencer="<%- locals.profileId %>"><div class="slat small"><i class="messages_growl_30"></i><div><h5><a href="/<%- locals.username.toLowerCase() %>"><%= locals.name %><a/></h5><p><%= (locals.message || "") %></p><% if(locals.mediaHtml) { %><div><%- locals.mediaHtml %></div><% } %></div></div></li>',
        h = '<li data-profile-id="<%- locals.profileId %>" data-entity-key="<%- locals.entityKey %>" data-img-url="<%- locals.imgUrl %>" data-username="<%= locals.username %>" data-name="<%= locals.name %>"><img src="<%- locals.imgUrl %>" /><div class="info"><h6><a title="<%= locals.name %>" href="/<%- locals.username.toLowerCase() %>"><%= locals.name %></a></h6></div><div class="controls"><span class="count empty">0</span></div></li>',
        j = {
            active: a("#messaging .list.active"),
            online: a("#messaging .list.online"),
            idle: a("#messaging .list.idle"),
            offline: a("#messaging .list.offline")
        }, p;
    Myspace.User.isLoggedIn && q()
})(jQuery);
(function () {
    function n() {
        comm.send("messaging.togglesetting", {
            settingName: "IsIMEnabled"
        }), G("playerMessaging", "presence", k.hasClass("on") ? "on" : "off")
    }
    function o() {
        comm.send("messaging.togglesetting", {
            settingName: "IsIMSoundEnabled"
        }), G("playerMessaging", "sound", l.hasClass("on") ? "on" : "off")
    }
    function s(a) {
        var b = d.find("section#" + a + " .horizontal");
        b.length && (r.setElm(b), r.toggleFlippers())
    }
    function w(a, b) {
        a ? (g.find("span").text(a), d.addClass("message" + (b ? " open" : "")), b && v.broadcast("opened"), g.addClass("fadeIn")) : (g.removeClass("fadeIn").addClass("fadeOut"), setTimeout(function () {
            d.removeClass("message open"), v.broadcast("closed"), g.removeClass("fadeOut")
        }, 1e3))
    }
    function B() {
        a.hasClass("queueOpen") && (x = setTimeout(function () {
            z && !d.hasClass("pinned") && (comm.send("drawer.close"), z = !1)
        }, 450))
    }
    function C(a) {
        t.indexOf(a) > -1 && (d.attr("data-panel") != a && (d.attr("data-panel", a), s(a)), v.broadcast("panel", a))
    }
    function D(b) {
        if (u) {
            A = !0, E();
            return
        }
        b === undefined && (b = !a.hasClass("queueOpen")), b && clearTimeout(x), b != a.hasClass("queueOpen") && (A = b, E(), v.broadcast(b ? "opened" : "closed", d.attr("data-panel")))
    }
    function E() {
        a.toggleClass("queueOpen", A)
    }
    function F(a, b) {
        $.extend(Cookies[a].values, b), Cookies.save(Cookies[a], "." + document.domain, (new Date).addDays(30))
    }
    function G(a, b, c) {
        comm.send("track", new Tracking(a, b, c))
    }
    var a = $("body"),
        b = $("#footer"),
        c = $("#player"),
        d = $("#drawer"),
        e = d.children("header"),
        f = $("#switcher"),
        g = $("#message"),
        h = $("#queue"),
        i = $("#mixes"),
        j = $("#popover"),
        k = $("#isIMEnabled"),
        l = $("#isIMSoundEnabled"),
        m = new CookieHelper("player");
    d.find('a[data-action="signin"]').click(function () {
        return comm.send("login.show", {
            signupContext: {
                promptAction: $(this).data("promptAction")
            }
        }), !1
    }), e.click(function (a) {
        var b = $(a.target),
            c = b.closest("[data-action]").data("action");
        switch (c) {
            case "incognito":
                var e = b.hasClass("on");
                G("player", "incognito", e ? "on" : "off"), comm.send("player.incognito", !e);
                break;
            case "presence":
                n();
                break;
            case "imsound":
                o();
                break;
            case "pin":
                d.toggleClass("pinned");
                var f = d.hasClass("pinned");
                G("player", "pin", f ? "on" : "off"), F("player", {
                    pinned: f
                })
        }
        return !c
    }), $("#globalSuperPost").click(function () {
        comm.send("photoCarousel.hide"), comm.send("rightRail.hide"), comm.send("superpost", {
            element: this
        })
    }), f.on("click", function (a) {
        var b = $(a.target).closest("[data-action]").data("action");
        return comm.send("drawer.panel", b), G("player", "panel", b), !b
    });
    var p = d.find(".leftFlipper"),
        q = d.find(".rightFlipper"),
        r = new Myspace.Flippers(h.find(".horizontal"), {
            leftFlipper: p,
            rightFlipper: q
        });
    p.bind({
        dragenter: function () {
            r.moveScroll("left")
        },
        dragleave: function () {
            r.stopScroll()
        }
    }), q.bind({
        dragenter: function () {
            r.moveScroll("right")
        },
        dragleave: function () {
            r.stopScroll()
        }
    });
    var t = ["queue", "mixes", "messaging", "radio"],
        u, v = comm.own("drawer", {
            toggle: D,
            togglePanel: function (b) {
                var c = d.attr("data-panel"),
                    e = a.hasClass("queueOpen");
                D(!e || c !== b), C(b)
            },
            open: function (a) {
                a && C(a), D(!0)
            },
            close: function (a) {
                a && C(a), D(!1)
            },
            closeOnLeave: function () {
                z = !0
            },
            panel: function (a) {
                C(a)
            },
            flippers: function () {
                r.toggleFlippers()
            },
            message: function (a) {
                w(a, !0)
            },
            cover: function (a) {
                w(a)
            },
            forceOpen: function (a) {
                u = a, a && D()
            }
        });
    a.on("click", function (a) {
        var b = $(a.target);
        !b.closest("#global, #drawer, #videoPlayer, .tour_footer, #messageBar").length && !d.hasClass("pinned") && D(!1)
    });
    var x, y, z = !1,
        A = a.hasClass("queueOpen");
    c.on("mouseleave", function () {
        y && clearTimeout(y)
    }).on("mousemove", function () {
        a.hasClass("queueOpen") || (y && clearTimeout(y), y = setTimeout(function () {
            comm.send("drawer.open"), z = !0
        }, 100))
    }), b.on("mouseleave", function () {
        B()
    }).on("mouseenter", function () {
        clearTimeout(x), z = !0
    }), j.on("mouseenter", function () {
        clearTimeout(x), z = !0
    }).on("mouseleave", function () {
        B()
    }), comm.listen({
        spaceway: {
            "+body.class": E
        }
    })
})();
(function (a) {
    function c() {
        b || (b = new Myspace.termsOfService), b.getTermsOfServicedata()
    }
    var b;
    Myspace.termsOfService = function () {
        function f() {
            e ? g(e) : a.ajax({
                url: "/ajax/termsOfService",
                type: "POST",
                dataType: "json"
            }).done(function (b) {
                b.html ? (a(d).remove(), e = b.html, g(e)) : comm.stopListening("spaceway.page.complete", c)
            }).fail(function () {
                console.log("Error occurred, while getting privacy policy."), comm.stopListening("spaceway.page.complete", c)
            })
        }
        function g(b, c) {
            a(d) && a(d).remove(), a(b).appendTo("body"), a("#confirm", a(d)).click(function () {
                h("yes", c)
            })
        }
        function h(b, e) {
            a.ajax({
                url: "/ajax/acceptTermsOfService",
                type: "POST",
                data: {
                    confirm: b
                },
                dataType: "json"
            }).done(function (b) {
                b.success ? (a(d).remove(), e ? comm.send("signin") : comm.stopListening("spaceway.page.complete", c)) : e ? comm.send("signin") : (a(d).hide(), comm.stopListening("spaceway.page.complete", c))
            }).fail(function () {
                e ? comm.send("signin") : (a(d).hide(), comm.stopListening("spaceway.page.complete", c))
            })
        }
        var d = "#termsOfService",
            e;
        return {
            showTermsOfService: g,
            getTermsOfServicedata: f
        }
    }, context.termsOfService && context.termsOfService.showTOSBOX && c(), comm.listen("spaceway.page.complete", function () {
        context.termsOfService && context.termsOfService.showTOSBOX && c()
    }, !0)
})(jQuery);
(function (a, b) {
    "use strict";
    var c, d = function () {
            if (c) return c;
            if (!(this instanceof d)) return new d;
            this.$container = a("#rightRail"), this.$rail = this.$container.find(".rail"), this.$nav = this.$container.find("nav"), this.activeSection = null, this.serviceUrl = "/ajax/rail", this.closeOnEscape = !0, this.closeOnClick = !0, this.wire(), c = this
        };
    d.prototype.escapeHandler = function () {
        this.closeOnEscape && !a("#lightboxCover").is(":visible") && this.$container.hasClass("open") && this.close()
    }, d.prototype.getEntity = function () {
        return this.$container.data()
    }, d.prototype.setEntity = function (a) {
        return this.$container.removeData().data(a)
    }, d.prototype.open = function () {
        a("body").addClass("railOpen"), this.$container.addClass("open"), this.resize(), comm.send("rightRail.opening")
    }, d.prototype.close = function () {
        a("body").removeClass("railOpen"), this.$container.removeClass("open"), comm.send("rightRail.closing")
    }, d.prototype.resize = function () {
        var b = this.$container.find(".railHeader").height() + a("#global").height() + a("#links").height() + 70,
            c = a(window).height() - b;
        this.$rail.height(c), this.resizeComments()
    }, d.prototype.resizeComments = function () {
        var b = this.activeSection;
        if (b) {
            var c = this.$container.find("section." + b + " .commentsControl"),
                d = c.find(".comments"),
                e = c.find(".addComment"),
                f = d.offset().top,
                g = f + a("#global").height() + a("#links").height() + e.outerHeight() + 45;
            d.css({
                "max-height": a(window).height() - g
            })
        }
    }, d.prototype.renderHeader = function () {
        var a = this.getEntity(),
            b = a.activityHtml,
            c = this.$container,
            d = c.find(".railHeader"),
            e = "",
            f = a.type.toLowerCase(),
            g = this;
        b && delete a.activityHtml;
        switch (f) {
            case "song":
                e = require("ejs").render(templates["areas/music/views/media/_songSquare"], {
                    songSquare: {
                        song: a,
                        size: "medium",
                        songUrl: a.url
                    }
                });
                break;
            case "album":
                e = require("ejs").render(templates["areas/music/views/media/_albumSquare"], {
                    albumSquare: {
                        album: a,
                        size: "medium",
                        albumUrl: a.albumUrl,
                        artistLink: a.artistUrl,
                        showMetaInfo: "yes",
                        notUseCommonHelper: !0
                    }
                });
                break;
            case "video":
                e = require("ejs").render(templates["areas/videos/views/shared/_videoHead"], {
                    video: a
                });
                break;
            case "mixtape":
                e = require("ejs").render(templates["areas/mixes/views/shared/_mixHead"], {
                    mix: a
                });
                break;
            case "photo":
                e = require("ejs").render(templates["areas/photos/views/_photoRightRailHead"], {
                    photo: a
                });
                break;
            case "article":
                e = require("ejs").render(templates["areas/discover/views/shared/_articleHead"], {
                    article: a
                })
        }
        a.influencerId && d.attr("data-influencer", a.influencerId), d.html(e), b && d.append(b), f == "photo" && comm.send("text.limit", {
            container: d,
            parent: c,
            lineHeight: 16,
            enableScroll: !0,
            expandAtStart: a.isRailPostExpanded,
            clickCallBack: function () {
                g.resize()
            }
        })
    }, d.prototype.createCommentsControl = function (a, c) {
        var d = this.$container.find("section." + a),
            e = d.find(".commentsControl"),
            f = this;
        if (e.length) {
            var g = new b.CommentsControl(e, {
                rightRail: !0
            });
            this.resizeComments(), g.scrollToBottom(), c && setTimeout(function () {
                g.focus()
            }, 500);
            var h = e.find(".showMore");
            h.click(function () {
                g.getMoreComments(50, function (a) {
                    h.find(".shown").text(a.numShown), a.hasMore || (h.remove(), f.resizeComments())
                })
            })
        }
    }, d.prototype.renderInfoSection = function (a) {
        function e() {
            d.createCommentsControl(c)
        }
        var b = this.getEntity(),
            c = "info",
            d = this;
        switch (b.type) {
            case "song":
                this.renderSection({
                    section: c,
                    entityId: b.mediaId,
                    entityType: "song",
                    commentEntitykey: b.commentEntitykey,
                    getConnectBtn: a
                }, e);
                break;
            case "album":
                this.renderSection({
                    section: c,
                    entityId: b.albumId,
                    entityType: "album",
                    commentEntitykey: b.commentEntitykey,
                    getConnectBtn: a
                }, e);
                break;
            case "video":
                this.renderSection({
                    section: c,
                    entityId: b.mediaId,
                    entityType: "video",
                    commentEntitykey: b.commentEntitykey,
                    getConnectBtn: a
                }, e);
                break;
            case "mixtape":
                this.renderSection({
                    section: c,
                    entityId: b.playlistId,
                    entityType: "mixtape",
                    profileId: b.profileId,
                    commentEntitykey: b.commentEntitykey,
                    getConnectBtn: a
                }, e);
                break;
            case "photo":
                this.renderSection({
                    section: c,
                    entityId: b.imageId,
                    profileId: b.profileId,
                    entityType: "photo",
                    playlistId: b.playlistId,
                    commentEntitykey: b.commentEntitykey,
                    getConnectBtn: a
                }, e);
                break;
            default:
        }
    }, d.prototype.renderCommentsSection = function (a) {
        function e() {
            d.createCommentsControl(c, b.focusOnCommentBox)
        }
        var b = this.getEntity(),
            c = "comments",
            d = this;
        this.renderSection({
            section: c,
            commentEntityKey: b.commentEntitykey,
            entityKey: b.entityKey,
            type: b.type,
            focusOnInput: b.focusOnCommentBox,
            start: 0,
            max: 10,
            getConnectBtn: a
        }, e)
    }, d.prototype.renderConnectionsSection = function (a) {
        var b = this.getEntity(),
            c = this,
            d = function () {
                var a = c.$container.find("section.connections"),
                    d = a.find(".grid"),
                    e = c.$rail.height() - a.find("h3").outerHeight(!0) - d.outerHeight(),
                    f = d.find("li").outerHeight(!0);
                if (f < e && f > 0) {
                    var g = parseInt(e / f, 10),
                        h = a.find(".pager").data("next-start");
                    typeof h != "undefined" && c.renderSection({
                        section: "connections",
                        entityKey: b.entityKey,
                        profileId: context.profileId,
                        start: h,
                        max: g,
                        paging: !0
                    })
                }
            };
        this.renderSection({
            section: "connections",
            entityKey: b.entityKey,
            profileId: context.profileId,
            getConnectBtn: a
        }, d)
    }, d.prototype.renderSection = function (b, c, d) {
        var e = b.paging || !1,
            f = this.$container.find("section." + b.section),
            g = this;
        e ? f.find("h3").after('<div class="loading white"></div>') : (this.showSection(b.section), f.addClass("loading white").html(""));
        var h = a.ajax({
            type: "POST",
            url: this.serviceUrl,
            data: b,
            timeout: 6e4
        });
        h.done(function (d) {
            if (e) f.find("h3, .loading").remove(), f.prepend(d.markup), f.find(".content").first().hide().slideDown();
            else {
                f.html(d.markup);
                var h = g.getEntity();
                !h.hideConnectButton && d.connectButton && g.$container.find(".railHeader").append(d.connectButton), !h.stats && d.entity && d.entity.stats && (g.$container.find(".railHeader .stats").hide().text(d.entity.stats.AllTime || "1").fadeIn(), g.setEntity(d.entity))
            } if (b.entityType === "mixtape") {
                var i = a("#mixMetaData", g.$container),
                    j = g.$container.find("div.mixtape > div:last-child");
                j.find("span").length === 0 && j.append(i.html())
            }
            c && c(), comm.send("page.changed", f)
        }), h.fail(function (a) {
            d && d(a)
        }), h.always(function () {
            f.removeClass("loading white")
        })
    }, d.prototype.switchSection = function (a) {
        if (a !== this.activeSection) switch (a) {
                case "info":
                    this.renderInfoSection();
                    break;
                case "comments":
                    this.renderCommentsSection();
                    break;
                case "connections":
                    this.renderConnectionsSection()
        }
    }, d.prototype.showSection = function (a) {
        var b = this.$rail.find("section." + a);
        this.$nav.find("a.active").removeClass("active"), this.$rail.find("section.active").removeClass("active"), this.$nav.find("a." + a).addClass("active"), b.addClass("active"), this.activeSection = a
    }, d.prototype.render = function (a, b) {
        a && (this.setEntity(a), a.hideTabs ? this.$nav.hide() : this.$nav.show()), this.renderHeader();
        switch (b) {
            case "info":
                this.renderInfoSection(!0);
                break;
            case "comments":
                this.renderCommentsSection(!0);
                break;
            case "connections":
                this.renderConnectionsSection(!0)
        }
        this.open()
    }, d.prototype.wire = function () {
        var b = this;
        this.$nav.on("click", "a", function (c) {
            var d = a(c.target).closest("a").attr("class");
            c.preventDefault(), b.switchSection(d)
        }), this.$container.on("click", ".connections .pager", function (c) {
            var d = a(c.target).closest(".pager"),
                e = d.data("next-start"),
                f = 50,
                g = b.getEntity();
            e > -1 && b.renderSection({
                section: "connections",
                entityKey: g.entityKey,
                profileId: context.profileId,
                start: e,
                max: f,
                paging: !0
            })
        }), a("body").on("click", function (b) {
            !a(b.target).closest("#rightRail, #footer").length && d().closeOnClick && d().$container.hasClass("open") && d().close()
        }), setTimeout(function () {
            b.$container.css("visibility", "visible")
        }, 500), a(window).resize(function () {
            b.$container.hasClass("open") && b.resize()
        })
    }, d.prototype.info = function (a) {
        this.render(a, "info")
    }, d.prototype.comments = function (a) {
        this.render(a, "comments")
    }, d.prototype.connections = function (a) {
        this.render(a, "connections")
    }, d.prototype.canShow = function () {
        var a = window.location.search.substring(1);
        return a.indexOf(config.urls.noRail) === -1
    }, comm.listen("rightRail.instance", function (a) {
        a(d())
    }, !0), comm.listen("rightRail.info", function (a) {
        d().info(a)
    }, !0), comm.listen("rightRail.comments", function (a) {
        d().comments(a)
    }, !0), comm.listen("rightRail.connections", function (a) {
        d().connections(a)
    }, !0), comm.listen("rightRail.hide", function () {
        d().close()
    }, !0), comm.listen("rightRail.show", function () {
        d().open()
    }, !0), comm.listen("spaceway.page.loading", function () {
        d().close()
    }, !0), comm.listen("page.esc", function () {
        d().escapeHandler()
    }, !0)
})(jQuery, window.Myspace = window.Myspace || {});
(function () {
    embedSWF(config.urls.clipboardSwf, "clipboard", null, {
        height: 1,
        width: 1,
        id: "clipboard"
    }, null, {
        wmode: "transparent",
        allowfullscreen: "false"
    })
})();
var ZeroClipboard = {
    dispatch: function (a, b, c) {
        switch (b) {
            case "load":
                comm.send("clipboard.ready", $("#" + a));
                break;
            default:
                comm.send("clipboard." + b)
        }
    }
};

function Tracking(a, b, c, d) {
    return !a && !b ? null : {
        category: a,
        action: b,
        label: c,
        value: d
    }
}(function (a) {
    comm.listen("track", function (a) {
        a && a.category && a.action && _gaq.push(["_trackEvent", a.category, a.action, a.label, a.value])
    }, !0)
})(jQuery);
comm.listen("report>song", function (a) {
    var b = objectify($('.playBtn[data-uid="' + a.uid + '"]')),
        c = [];
    for (var d in b) c.push(d + ":" + b[d]);
    var e = Myspace.Confirm({
        text: "What's wrong with " + b.title + " by " + b.artistName + '? <textarea id="reportSongMessage"></textarea><pre>' + c.join("<br>") + "</pre>",
        no: {
            text: "Cancel"
        },
        yes: {
            text: "Send Report",
            onClick: function () {
                b.message = $("#reportSongMessage")[0].value, b.profileId = context.profileId, b.username = context.username, b.pfc = context.pfc, b.url = location.href, b.trackingId = context.uuid, console.log(b), $.save({
                    url: "/ajax/report/song",
                    data: b
                })
            }
        },
        beforeShow: function (a) {
            a.$root.width(660)
        }
    });
    $("#confirmDialog pre").css({
        textAlign: "left",
        fontSize: 9
    })
}, !0);
(function (a) {
    function c(a) {
        var c = a.id,
            d = document.getElementById(c),
            e, f, g, h;
        if (a.format != "img" && !d) return;
        e = b[c];
        if (e) {
            f = a.refreshDelay ? a.refreshDelay * 1e3 : 2e3;
            if (+(new Date) - e < f) return
        }
        g = document.location.protocol + "//" + a.subdomain + ".specificclick.net/", g += a.subdomain == "afe2" ? "adserve/" : "", g += "?l=" + a.locationId + "&sz=" + a.size + "&t=h";
        var i = a.querystring || context.ads.querystring;
        i && (g += "&" + i), g += "&rnd=" + Math.floor(Math.random() * 1e8), a.format == "img" ? (new Image).src = g : (h = a.size.split("x"), d.innerHTML = '<iframe style="width:' + h[0] + "px;height:" + h[1] + 'px;" frameborder="0" scrolling="no" alltransparency="true" src="' + g + '"></iframe>'), b[c] = +(new Date)
    }
    function d(a) {
        var b = document.location.protocol + "//" + a.subdomain + ".specificclick.net/?y=2&t=i&tpr=0&spd=1";
        a.pixelId && (b += "&pixid=" + a.pixelId), a.networkId && (b += "&nid=" + a.networkId);
        if (!a.targetingDisabled) {
            var c = a.querystring || context.ads.querystring;
            c && (b += "&" + c)
        }
        b += "&rnd=" + Math.floor(Math.random() * 1e8), (new Image).src = b
    }
    function e(a, b, c) {
        var d = a - b;
        return d < 0 ? 0 : d > c ? c : d
    }
    function f(a, b, c, d) {
        var e = a + b - c;
        return e > d ? d : e
    }
    function g() {
        return {
            width: window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth,
            height: window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight,
            x: window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft,
            y: window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop
        }
    }
    function h(a) {
        if (a.length === 0) return 0;
        var b = g(),
            c = a.offset(),
            d, h, i, j;
        return c.height = a.height(), c.width = a.width(), c.height === 0 || c.width === 0 ? 0 : (d = e(b.y, c.top, c.height), h = f(b.y, b.height, c.top, c.height), i = e(b.x, c.left, c.width), j = f(b.x, b.width, c.left, c.width), (h - d) / c.height * ((j - i) / c.width))
    }
    function i() {
        function e(a) {
            setTimeout(function () {
                b && (c(a), e(a))
            }, a.refreshInterval * 1e3)
        }
        var b = !1,
            d = [];
        this.startAutoRefresh = function (a) {
            b = !0, c(a), e(a)
        }, this.addActionRefresh = function (a) {
            d.push(a)
        }, this.actionRefresh = function () {
            a.each(d, function (b, d) {
                if (h(a("#" + d.id + " iframe")) >= .5) return c(d), !1
            })
        }, this.clear = function () {
            b = !1, d = []
        }
    }
    function j() {
        if (!context.ads) return;
        var a = context.ads.adCalls || [],
            b = context.ads.pixels || [];
        a.forEach(function (a) {
            a.actionRefresh && adRefresher.addActionRefresh(a), a.refreshInterval > 0 ? adRefresher.startAutoRefresh(a) : c(a)
        }), b.forEach(function (a) {
            d(a)
        })
    }
    function k() {
        b = {}, adRefresher.clear(), context.ads = {}
    }
    var b = {};
    window.adRefresher = new i, comm.listen("spaceway.page.beforeCleanup", k, !0), comm.listen("spaceway.page.complete", j, !0), comm.listen("ads.loadPixel", c, !0), a(window).ready(function () {
        j()
    })
})(window.jQuery);
var spaceway = spaceway || {};
spaceway.logger = function () {
    function g(a, b) {
        return $("<style type='text/css'>" + a + "</style>")[b ? "prependTo" : "appendTo"]("head")[0]
    }
    function h() {
        if (queryString.dockedLogger) g('.logger { z-index: 1000000000; overflow:scroll; color:#fff; white-space:nowrap; position:fixed; top:0; left:0; background-color:#000; width:30%; height:100%; font-size:14px; font-family:"Courier New"; } .logger a:link { color:inherit; text-decoration:none; } .logger .success { color:lime; } .logger .info { color:cyan; } .logger .warn { color:magenta; } .logger .error { color:red; }').className = "spaceway", b = document.createElement("div"), document.body.appendChild(b);
        else if (!jQuery.browser.msie) {
            var a = window.open("", "logger", "width=300,height=" + (window.screen.availHeight || 1e3) + ",scrollbars=yes");
            if (a == null || a == undefined) return;
            a.moveTo(0, 0), a.document.write('<!doctype html><html><head><script type="text/javascript">var comm = window.opener.jQuery.comm;</script><style>body, .logger { color:#fff; background-color:#000; white-space:nowrap; width:100%; font-size:14px; font-family:"Courier New"; } a:link { color:inherit; text-decoration:none; } .success { color:lime; } .info { color:cyan; } .warn { color:magenta; } .error { color:red; }</style></head><body><div><input type="text" id="url"><button onclick="comm.send(\'location.href\', document.getElementById(\'url\').value);">Navigate</button></div><div id="log"></div></body></html>'), a.document.close(), b = a.document.getElementById("log")
        } else {
            var a = window.open("/Modules/common/pages/Debugger.htm", "logger", "scrollbars=1,resizable=1,width=600,height=" + (window.screen.availHeight || 1e3));
            if (a == null || a == undefined) return;
            a.opener = window;
            try {
                f = a.document.getElementById("log")
            } catch (c) {
                setTimeout(function () {
                    f = a.document.getElementById("log")
                }, 3e3)
            }
            b = f
        }
        b && (b.className = "logger")
    }
    function i(a, g) {
        f && (b = f);
        if (!b) return;
        var h = "";
        if (c !== a) {
            var i = document.createElement("p");
            try {
                i.innerHTML = h + a
            } catch (j) {}
            i.setAttribute("class", g), c = a, d = i, e = 1;
            if (jQuery.browser.msie) try {
                    jQuery(b).prepend(i.outerHTML)
            } catch (j) {
                b.innerHTML = i.innerHTML + b.innerHTML.substring(0)
            } else b.insertBefore(i, b.firstChild)
        } else d.innerHTML = h + c + " - x " + ++e;
        return i
    }
    var a = window,
        b, c, d, e = 0,
        f;
    return {
        log: i,
        create: h
    }
};
var spaceway = spaceway || {};
spaceway.transacter = function (a, b) {
    function d(a, b) {
        c.push({
            work: a,
            name: b
        })
    }
    function e() {
        if (!c || !c.length) return;
        var a = c[0];
        c.splice(0, 1), a.done = function (b) {
            a.success = b, g(a)
        }, a.work(a)
    }
    function f() {
        a()
    }
    function g(a) {
        a.success || (b("work item failed: " + a.name), f()), window.setTimeout(function () {
            e()
        }, 0)
    }
    function h() {
        e()
    }
    var c = [];
    return {
        add: d,
        execute: h
    }
};
var config = config || {
    staticContentBase: "/"
}, beacon = {
        qs: ""
    };
spaceway.enabled = !0, comm.listen("location.href", function (a) {
    var b = spaceway.sendRequest,
        c = spaceway.pushState;
    typeof a == "string" ? b && a.indexOf("http") == -1 ? b(a) : top.location.href = a : c && typeof a == "object" && a.hasOwnProperty("url") && c(a.url, a)
}, !0),
function (a, b) {
    function X(a, b) {
        var c = y[b];
        pb(a + b), Y(b || t, null, !0);
        if (c && c.hasOwnProperty("loadState") && c.loadState(b, c, u)) {
            tb("calling overridden loadState function");
            return
        }
        Z(b || t, !0)
    }
    function Y(a, b, c, d) {
        v = u, u = a, window.queryString = a.indexOf("?") >= 0 ? a.split("?")[1].parseNameValuePairs() : {}, H++, w = "beam" + u.split("?")[0].replace(/(\/|\.)/igm, "-");
        if (c) return;
        b && (y[a] = b), d && window.history.replaceState ? window.history.replaceState(a, document.title, a) : window.history.pushState ? window.history.pushState(a, document.title, a) : window.location.hash = "!" + a
    }
    function Z(b, c, d) {
        D && F && (F.aborted = !0, F.abort(), sb("aborted " + u), nb(!1)), _start = new Date, vb(), pb("beaming up " + b), nb(!0), D = !0, P.broadcast("page.loading", b), I = spaceway.transacter(function () {
            ob()
        }, {
            log: pb
        });
        var e = null;
        L[b] && (e = JSON.parse(L[b])) && e.cache && e.cache.expiration > +(new Date) ? (J || I.add(function (a) {
            cb(), a.done(!0)
        }), tb("cached response for " + b), _(b, e, !1, !0)) : (V.xhrs[b] ? (tb("waiting for pending request for: " + b), F = V.xhrs[b]) : F = $(b), J || I.add(function (a) {
            cb(), a.done(!0)
        })), Y(b, null, c, d), I.execute(), a("> a", T).removeClass("selected").filter('a[href="' + b.replace("'", "%27") + '"]').addClass("selected")
    }
    function $(b, c) {
        return a.ajax({
            url: b,
            type: "POST",
            headers: {
                Spaceway: "0111001001101111011000100110001001111001"
            },
            success: function (a, d, e) {
                F === e && (c = !1), c || (D = !1);
                if (e.aborted) return;
                B && console.log(a), _(b, a, c)
            },
            error: function (a, b, d) {
                F === a && (c = !1), c || (D = !1);
                if (a.aborted) return;
                sb(d), B && (e.innerHTML = a.responseText, console.log(a), console.log(b), console.log(d)), P.broadcast("trace", {
                    message: "beam error",
                    error: d,
                    desc: b,
                    status: a.status,
                    statusText: a.statusText
                });
                if (c) return;
                ob()
            },
            dataType: "json"
        })
    }
    function _(a, b, c, d) {
        if (b && b.redirect) {
            rb("redirect! " + a + " to " + b.redirect), Z(b.redirect, null, !0);
            return
        }
        if (!b || b.status && b.status === "Error" || !b.html && !b.subnav) {
            ob();
            return
        }!d && b.cache && b.cache.expirationSeconds > 0 && (b.cache.expiration = +(new Date(+(new Date) + b.cache.expirationSeconds * 1e3)), Ab(a, b) ? (rb("caching " + a + " for " + b.cache.expirationSeconds + " seconds"), V.add(a, b.cache.expirationSeconds, b.cache.canKeepFresh)) : sb("unable to cache " + a + ". cache is full"));
        if (c) return;
        tb("processing page..."), P.broadcast("page.processing", b);
        var e = _start;
        _start = new Date, _start.servertime = _start - e, _start.onload = _start - 1, ab(b), F = null
    }
    function ab(d) {
        r = d, mb(), I.add(function (a) {
            _start.BeforeCSS = +(new Date), a.done(!0)
        }), ib(), I.add(function (a) {
            _start.AfterCSS = +(new Date), a.done(!0)
        }), I.add(function (a) {
            window.setTimeout(function () {
                a.done(!0)
            }, 25)
        }), I.add(function (d) {
            pb("before content innerHTML"), Array.forEach(k, function (a) {
                a.disabled = !0
            }), b.setAttribute("class", h + " " + w), g.attr("class", r.bodyClass.trim()), a(c).attr("data-uid", r.context.uuid), P.broadcast("body.class"), e.innerHTML = r.html, f.add(g).scrollTop(0), a.merge(l, document.querySelectorAll("#wrap > style")), a("#header, #sidebar").remove(), r.sidebar && a(r.sidebar).insertBefore(e), r.subnav && a(r.subnav).insertBefore(e);
            if (r.templates) for (var i in r.templates) templates[i] = r.templates[i];
            x && (window.location.hash = x, x = null);
            var j = document.createElement("b");
            j.innerHTML = r.title || "Myspace", document.title = a(j).text(), document.write = a.noop, comm.send("page.changed", a(e)), nb(!1), d.done(!0)
        }, "innerHTML"), J && I.add(function (a) {
            cb(), a.done(!0)
        }), I.add(function (a) {
            k = k.concat(l), l = [], _start.BeforeJS = +(new Date), window.context = r.context, _gaq.push(["_trackPageview"], u), window.COMSCORE && COMSCORE.beacon && COMSCORE.beacon({
                c1: "2",
                c2: "4000002"
            }), a.done(!0)
        }, "contexts, json resources, gaq"), C && kb(), I.add(function (a) {
            _start.Ready = +(new Date), zb(), P.broadcast("page.complete"), _start.AfterReady = +(new Date), tb("page load complete."), vb(), U.send(), a.done(!0)
        }, "calling page ready events"), I.execute()
    }
    function bb(a, b) {
        var c = jQuery._data(a),
            d, e, f, g;
        if (c) {
            d = c.events;
            for (e in d) {
                f = d[e], skip = 0;
                while (g = f[f.length - skip - 1]) {
                    if (b && /beforeunload|hashchange|popstate|storage/.test(g.type)) {
                        skip++;
                        continue
                    }
                    jQuery(a).unbind(g.type, g.handler)
                }
            }
        }
        a._events && delete a._events.load
    }
    function cb() {
        rb("cleaning up"), P.broadcast("page.beforeCleanup"), comm._clearListeners(), bb(window, 1), bb(document), a.isReady = !1, J || (a(e).empty(), a("#header, #sidebar").remove()), g.add(c).add(d).attr("style", ""), a("> :not(div#player):not(object):not(div#container):not(div#dialogCover):not(#lightboxCover):not(.dialog):not(.lightbox):not(footer):not(script):not(iframe):not(article#loginDialog):not(article#signupDialog):not(div.logger):not(#LocalConnection):not(#popover):not(#myspaceTip):not(#fb-root)", document.body).remove(), Array.forEach(j, W), Array.forEach(k, W), j.length = k.length = 0, a('link[type="text/css"], style:not(.spaceway)').each(function (a, b) {
            var c = !! b.href;
            if (l.indexOf(b) >= 0) return;
            if (!c || !n[(b.href.indexOf("://") > -1 ? "" : s) + b.href]) pb("removing " + (c ? "linked style" : "style node") + " that was not tracked" + (c ? ": " + b.href : "")), W(b);
            B && !c && console.log(b)
        });
        if (!spaceway.washer) return;
        var b = jQuery.grep(window.delta(), function (a, b) {
            return !db[a]
        });
        queryString.deltas && console.log(b), jQuery.each(b, function (a, b) {
            try {
                if (delete window[b]) return;
                queryString.deltas && console.log("window['" + b + "'] is marked DontDelete. Assigning undefined instead."), window[b] = undefined
            } catch (c) {
                return
            }
        })
    }
    function eb(b) {
        return a.cors(b, {
            timeout: +(queryString.corsTimeout || 3e3)
        })
    }
    function fb(b, c) {
        return a("<style type='text/css'>" + b + "</style>")[c ? "prependTo" : "appendTo"]("head")[0]
    }
    function gb(a, b) {
        var c = fb(b);
        c.disabled = !0, a && (c.setAttribute("data-spaceway-src", a), c.src = a);
        if (J && c.sheet.deleteRule) {
            var d = c.sheet.cssRules;
            for (var e = 0; e < d.length; e++) try {
                    if (d[e].media) {
                        var f = "@media ",
                            g = "";
                        for (var h = 0; h < d[e].media.length; h++) f += d[e].media[h] + " ";
                        for (var i = 0; i < d[e].cssRules.length; i++) g += "." + w + " " + d[e].cssRules[i].cssText;
                        c.sheet.deleteRule(e), c.sheet.insertRule(f + "{" + g + "}", e);
                        continue
                    }
                    if (!d[e].style) continue;
                    var j = d[e].selectorText,
                        k = d[e].style.cssText;
                    if (!j || !k) continue;
                    var m = "." + w + (j.startsWith("html.") ? j.substr(4) : " " + j).replace(/,/igm, ", ." + w) + "{" + k + "}";
                    c.sheet.deleteRule(e), c.sheet.insertRule(m, e)
            } catch (n) {
                console.log(c.sheet), console.log(n.message), sb(a + " - " + e + " - " + j + " - " + k + " - " + n)
            }
        }
        c.disabled = !1, l.push(c)
    }
    function hb(a, b) {
        qb("css: " + a + " - linked.");
        var c = document.createElement("link");
        c.type = "text/css", c.rel = "stylesheet", c.href = a, p.appendChild(c), l.push(c), b.done(!0)
    }
    function ib() {
        Array.forEach(r.styles, function (a) {
            if (a.href) {
                var b = a.href.indexOf("://") > -1,
                    c = a.href.indexOf("://") + 3,
                    d;
                if (n[(b ? "" : s) + a.href]) return;
                d = b ? a.href.substr(c, a.href.indexOf("/", c) - c) : window.location.host, !queryString.cors && Array.find(K, function (a) {
                    return d.endsWith(a)
                }) ? I.add(function (b) {
                    var c = qb("css with cors: " + a.href) || {};
                    L[a.href] ? (c.innerHTML += " - cached.", gb(a.href, L[a.href]), b.done(!0)) : eb(a.href).done(function (a, d) {
                        c.innerHTML += " - done.", window.console && console.log("done"), config.staticContentBase !== "http://x.myspacecdn.com" && (d = d.replace(/http:\/\/x.myspacecdn.com\/modules\//igm, "/modules/")), d = d.replace(/\/modules\//igm, config.staticContentBase + "/modules/"), gb(a, d), Ab(a, d), b.done(!0)
                    }).fail(function () {
                        B && (c.innerHTML += ' - <span class="error">failed!' + a.href + "</span>"), window.console && console.log("css cors request failed! - " + a.href), hb(a.href, b)
                    })
                }, "css cors get: " + a.href) : I.add(function (b) {
                    hb(a.href, b)
                })
            } else a.text && I.add(function (b) {
                    qb("adding style literal"), gb(null, a.text), b.done(!0)
                })
        })
    }
    function jb(a, b) {
        try {
            var c = document.createElement("script");
            a && !b ? c.src = a : b && (a && c.setAttribute("data-spaceway-src", a), b = (a ? "/* " + a + " */" : "") + "try{ " + b + " } catch(e){ console.log(e.stack || e); }", z ? c.text = b : c.appendChild(document.createTextNode(b))), p.appendChild(c), j.push(c)
        } catch (d) {
            sb("error executing script" + (a ? ": " + a : " literal <code>" + b + "</code>") + " - " + d)
        }
    }
    function kb() {
        Array.forEach(r.scripts, function (a) {
            var b;
            if (a.src) {
                var c = a.src.indexOf("://") > -1,
                    d = a.src.indexOf("://") + 3,
                    e;
                if (m[(c ? "" : s) + a.src]) return;
                e = c ? a.src.substr(d, a.src.indexOf("/", d) - d) : window.location.host, !queryString.cors && Array.find(K, function (a) {
                    return e.endsWith(a)
                }) ? I.add(function (b) {
                    var c = qb("js with cors: " + a.src) || {};
                    L[a.src] ? (c.innerHTML += " - cached.", jb(a.src, L[a.src]), b.done(!0)) : eb(a.src).done(function (a, d) {
                        c.innerHTML += " - done.", jb(a, d), Ab(a, d), b.done(!0)
                    }).fail(function () {
                        c.innerHTML += ' - <span class="error">failed!</span>', jb(a.src), window.console && console.log(' - <span class="error">failed!' + a.src + "</span>"), c.innerHTML += " - linked.", b.done(!0)
                    })
                }, "js cors get: " + a.src) : I.add(function (b) {
                    var c = qb("js external: " + a.src) || {};
                    jb(a.src), c.innerHTML += " - linked.", b.done(!0)
                })
            } else a.text && I.add(function (b) {
                    qb("inserting js literal"), jb(null, a.text), b.done(!0)
                }, "js literal")
        })
    }
    function lb(a) {
        if (!a._events || !a._events.load) return;
        for (var b = 0; b < a._events.load.length; b++) a._events.load[b].handler(new Sys.UI.DomEvent({}))
    }
    function mb() {
        window.clearTimeout(M), M = window.setTimeout(function () {
            ob()
        }, O)
    }
    function nb(c) {
        E && E.remove();
        if (!c || N) {
            g.removeClass("beaming"), b.style.cursor = "", window.clearInterval(N), N = 0, window.clearTimeout(M), M = 0, G = null, D = !1;
            return
        }
        D = !0, E = a('<iframe src="/loading" height="0" width="0"></iframe>').appendTo(g), g.addClass("beaming"), ub(), b.style.cursor = "progress", N = window.setInterval(function () {
            ub()
        }, 500), M = window.setTimeout(function () {
            ob()
        }, O)
    }
    function ob() {
        nb(!1);
        if (B) {
            sb("cancelling reboot while debugger is open");
            return
        }
        sb("rebooting spaceway..."), window.location.href = u ? u : window.location.href
    }
    function pb(a, b) {
        return i.log(a, b)
    }
    function qb(a) {
        return pb(a, "info")
    }
    function rb(a) {
        return pb(a, "warn")
    }
    function sb(a) {
        return pb(a, "error")
    }
    function tb(a) {
        return pb(a, "success")
    }
    function ub() {
        G ? G.innerHTML += "." : G = rb("waiting...")
    }
    function vb() {
        pb("<hr>")
    }
    function wb() {
        vb(), a("link[rel=stylesheet]").each(function () {
            var a = this.href.replace("://", "").substr(this.href.replace("://", "").indexOf("/"));
            this.href.toLowerCase().indexOf("/common/css/") != -1 ? (n[this.href] = !0, pb("common styles: " + a)) : k.push(this)
        })
    }
    function xb() {
        vb(), a("script[src]").each(function () {
            var a = this.src.replace("://", "").substr(this.src.replace("://", "").indexOf("/"));
            S.test(this.src) ? (m[(this.src.startsWith("http") ? "" : config.staticContentBase) + this.src] = !0, pb("common script: " + a)) : (j.push(this), tb("script: " + a))
        })
    }
    function yb(b) {
        B = b, B && (i.create(), a("#globalNav, #globalHeader").css({
            "background-color": "#39f"
        }))
    }
    function zb() {
        window.Sys && Sys.Application.initialize(), lb(window), lb(document);
        try {
            a.ready(), comm.send("page.changed", a(e))
        } catch (b) {
            sb(b)
        }
    }
    function Ab(a, b) {
        try {
            return L[a] = typeof b == "object" ? JSON.stringify(b) : b, !0
        } catch (c) {
            try {
                L.clear()
            } catch (d) {}
        }
        return !1
    }
    if (a.browser.msie && a.browser.version < 8) return;
    sessionStorage && queryString.spaceway && (sessionStorage.spaceway = queryString.spaceway);
    if (!spaceway || !spaceway.enabled || sessionStorage && sessionStorage.spaceway === "off") return;
    var c = a("#wrap")[0],
        d = c,
        e = c,
        f = a(b),
        g = a(document.body),
        h, i = new spaceway.logger,
        j = [],
        k = [],
        l = [],
        m = {}, n = {}, o = [],
        p = a("head")[0],
        q = a("title"),
        r, s = window.location.protocol + "//" + window.location.host,
        t = window.location.href.replace(s, ""),
        u, v, w, x, y = {}, z = a.browser.msie,
        A = typeof XDomainRequest != "undefined" || typeof XMLHttpRequest != "undefined",
        B = queryString["debugger"],
        C = !queryString.js,
        D, E, F, G, H = 0,
        I, J = !(a.browser.msie && a.browser.version <= 8),
        K = ["www.myspace.com", ".myspacecdn.com", window.location.host],
        L = window.sessionStorage,
        M = 0,
        N = 0,
        O = spaceway.timeout || 5e4,
        P = comm.own("spaceway", {}),
        Q = /^([\w:\/.]+myspace\.(com|dev))(\/?[^#]*)#?(.*)/i,
        R = /^(pm_cmp|mssrc)=.+/,
        S = /\/(ad_wrapper|msglobal|wim)/i,
        T = a("#nav").append('<span class="spacewayLoader">Loading</span>'),
        U = {
            send: function () {
                return;
                var a, b
            }
        }, V = {
            items: {},
            xhrs: {},
            running: !1,
            debug: !! queryString.primerDebug,
            start: function () {
                if (!spaceway.primer) return;
                V.running = !0;
                for (var a = 0; a < spaceway.prime.length; a++) V.add(spaceway.prime[a], -1, !0);
                window.setTimeout(function () {
                    if (!V.running) return;
                    for (var a in V.items) {
                        var b = V.items[a];
                        if (b.expiration < new Date) {
                            var c;
                            V.debug && (c = rb("expired content " + b.url)), delete V.items[b.url], L.removeItem(b.url), b.keepFresh && (V.debug && c && (c.innerHTML += " - refetching"), V.xhrs[b.url] = $(b.url, !0))
                        }
                    }
                    V.debug && rb("checking primer"), window.setTimeout(arguments.callee, 1e3)
                }, 1e3)
            },
            stop: function () {
                V.running = !1
            },
            add: function (a, b, c) {
                var d = {
                    url: a,
                    keepFresh: c,
                    expiration: new Date(+(new Date) + b * 1e3),
                    lastUpdated: new Date
                };
                V.items[a] = d, delete V.xhrs[a], V.debug && tb("adding to primer: " + JSON.stringify(d))
            }
        }, W = z && a.browser.version <= 8 ? function (a) {
            a.removeNode(!0)
        } : function (a) {
            a.parentNode && a.parentNode.removeChild(a)
        };
    a(window).bind("hashchange", function () {
        var a = window.location.hash,
            b = a.substr(2);
        if (a.substr(0, 3) !== "#!/" || b === u) {
            rb("ignored hash changed:" + a);
            return
        }
        X("hash changed: ", b)
    }).bind("popstate", function (a) {
        var b = a.originalEvent.state;
        if (b === u || !b) return;
        X("state popped: ", b)
    }), g.delegate('[href]:not([href^="#"]):not([href*="/signout"]):not([href*="https://"]):not([target]):not([href*="javascript:"])', "click", function (a) {
        if (a.ctrlKey || a.shiftKey || H >= (spaceway.rebootCount || 5e3)) {
            rb("ignoring click");
            return
        }
        var b = Q.exec(this.href);
        if (!b) {
            rb("last chance click, ignoring a[href=" + this.href + "]");
            return
        }
        var c = b[3],
            d = b[4],
            e = beacon.qs;
        return tb('caught "a" click:' + c), d && R.test(d) ? (e && e.substr(-1) !== "&" && (e += "&"), beacon.qs = e + d) : d && (x = d), pendingPFC = this.getAttribute("data-pfc"), Z(c), !1
    });
    var db = spaceway.whitelist = {
        _firebug: 1,
        _FirebugCommandLine: 1,
        loadFirebugConsole: 1,
        console: 1,
        _FirebugConsole: 1,
        get_overlay: 1,
        $q: 1,
        $get: 1,
        $find: 1,
        _events: 1,
        $removeHandler: 1,
        $clearHandlers: 1,
        $addHandlers: 1,
        $addHandler: 1,
        $create: 1,
        Sys: 1,
        Type: 1,
        queryString: 1,
        jQuery: 1,
        swfobject: 1,
        MySpaceClientContext: 1,
        MySpace: 1,
        MySpaceRes: 1,
        namespace: 1,
        SWFObject: 1,
        scomm: 1,
        Advertiser: 1,
        sm_wrapper: 1,
        adRefresher: 1,
        punymce: 1
    };
    db[jQuery.expando] = 1, a.extend(spaceway, {
        ready: zb,
        debug: yb,
        sendRequest: Z,
        pushState: Y,
        scripts: m,
        css: n,
        styles: k,
        response: function () {
            return r
        },
        logger: i,
        cache: L
    }), Object.defineProperty(spaceway, "href", {
        enumerable: !0,
        get: function () {
            return u || t
        },
        set: function (a) {
            Z(a)
        }
    }), B && yb(!0), pb("spaceway initializing"), h = f.addClass("spaceway").attr("class"), V.start(), a(function () {
        return wb(), xb(), pb("spaceway ready"), P.broadcast("ready"), window.history.replaceState(t, document.title, t), !0
    }), comm.listen("page.idle", function (a) {
        if (a < 5) return;
        return V.stop(), !0
    })
}(jQuery, document.documentElement);
(function (a, b, c, d) {
    var e = a(b);
    a.fn.lazyload = function (c) {
        function i() {
            var b = 0;
            f.each(function () {
                var c = a(this);
                if (h.skip_invisible && !c.is(":visible")) return;
                if (!a.abovethetop(this, h) && !a.leftofbegin(this, h)) if (!a.belowthefold(this, h) && !a.rightoffold(this, h)) c.trigger("appear"), b = 0;
                    else if (++b > h.failure_limit) return !1
            })
        }
        var f = this,
            g, h = {
                threshold: 0,
                failure_limit: 0,
                event: "scroll",
                effect: "show",
                container: b,
                data_attribute: "original",
                skip_invisible: !0,
                appear: null,
                load: null
            };
        return c && (d !== c.failurelimit && (c.failure_limit = c.failurelimit, delete c.failurelimit), d !== c.effectspeed && (c.effect_speed = c.effectspeed, delete c.effectspeed), a.extend(h, c)), g = h.container === d || h.container === b ? e : a(h.container), 0 === h.event.indexOf("scroll") && g.bind(h.event, function (a) {
            return i()
        }), this.each(function () {
            var b = this,
                c = a(b);
            b.loaded = !1, c.one("appear", function () {
                if (!this.loaded) {
                    if (h.appear) {
                        var d = f.length;
                        h.appear.call(b, d, h)
                    }
                    a("<img />").bind("load", function () {
                        c.hide().attr("src", c.data(h.data_attribute))[h.effect](h.effect_speed), b.loaded = !0;
                        var d = a.grep(f, function (a) {
                            return !a.loaded
                        });
                        f = a(d);
                        if (h.load) {
                            var e = f.length;
                            h.load.call(b, e, h)
                        }
                    }).attr("src", c.data(h.data_attribute))
                }
            }), 0 !== h.event.indexOf("scroll") && c.bind(h.event, function (a) {
                b.loaded || c.trigger("appear")
            })
        }), comm.listen("spaceway.page.complete", function () {
            i()
        }), e.unbind("resize").bind("resize", function (a) {
            i()
        }), /iphone|ipod|ipad.*os 5/gi.test(navigator.appVersion) && e.bind("pageshow", function (b) {
            b.originalEvent.persisted && f.each(function () {
                a(this).trigger("appear")
            })
        }), a(b).load(function () {
            i()
        }), this
    }, a.belowthefold = function (c, f) {
        var g;
        return f.container === d || f.container === b ? g = e.height() + e.scrollTop() : g = a(f.container).offset().top + a(f.container).height(), g <= a(c).offset().top - f.threshold
    }, a.rightoffold = function (c, f) {
        var g;
        return f.container === d || f.container === b ? g = e.width() + e.scrollLeft() : g = a(f.container).offset().left + a(f.container).width(), g <= a(c).offset().left - f.threshold
    }, a.abovethetop = function (c, f) {
        var g;
        return f.container === d || f.container === b ? g = e.scrollTop() : g = a(f.container).offset().top, g >= a(c).offset().top + f.threshold + a(c).height()
    }, a.leftofbegin = function (c, f) {
        var g;
        return f.container === d || f.container === b ? g = e.scrollLeft() : g = a(f.container).offset().left, g >= a(c).offset().left + f.threshold + a(c).width()
    }, a.inviewport = function (b, c) {
        return !a.rightoffold(b, c) && !a.leftofbegin(b, c) && !a.belowthefold(b, c) && !a.abovethetop(b, c)
    }, a.extend(a.expr[":"], {
        "below-the-fold": function (b) {
            return a.belowthefold(b, {
                threshold: 0
            })
        },
        "above-the-top": function (b) {
            return !a.belowthefold(b, {
                threshold: 0
            })
        },
        "right-of-screen": function (b) {
            return a.rightoffold(b, {
                threshold: 0
            })
        },
        "left-of-screen": function (b) {
            return !a.rightoffold(b, {
                threshold: 0
            })
        },
        "in-viewport": function (b) {
            return a.inviewport(b, {
                threshold: 0
            })
        },
        "above-the-fold": function (b) {
            return !a.belowthefold(b, {
                threshold: 0
            })
        },
        "right-of-fold": function (b) {
            return a.rightoffold(b, {
                threshold: 0
            })
        },
        "left-of-fold": function (b) {
            return !a.rightoffold(b, {
                threshold: 0
            })
        }
    })
})(jQuery, window, document);
(function (a) {
    comm.listen("text.limit", function (b) {
        var c = b.container,
            d = b.parent,
            e = b.lineHeight || 20,
            f = b.showLessLines || 1,
            g = b.enableScroll,
            h = b.clickCallBack,
            i = b.noBind,
            j = b.expandAtStart,
            k = e * f;
        c.find(".postText").each(function () {
            var b, c, f, l = a(this),
                m, n = d || l.parent(),
                o;
            n.removeClass("expanded showMore keep enablescroll"), b = this.scrollHeight, c = this.offsetHeight, f = b - c, o = g && b >= n[0].offsetHeight * .6, f > e ? (m = l.next(), n.addClass("showMore"), i || (f > k ? m.children("a").click(function () {
                var b = a(this),
                    c = d || b.parent().parent();
                c.hasClass("expanded") ? (c.hasClass("enablescroll") && c.scrollTop(0), c.removeClass("expanded"), b.text("Show more"), h && h(!1)) : (c.addClass("expanded keep"), b.text("Show less"), h && h(!0))
            }) : m.children("a").click(function () {
                var b = d || a(this).parent().parent();
                b.addClass("expanded"), h && h(!0)
            }), j && (n.addClass("expanded keep"), m.children("a").text("Show less")))) : f && f <= e && n.addClass("expanded"), o && n.addClass("enablescroll")
        })
    }, !0)
})(jQuery);
var Myspace = Myspace || {};
Myspace.MixCoverUploader = function (a) {
    function f(a) {
        c = a, c.playlist && (d = c.playlist.playlistId), b = new Myspace.LiteUploader({
            MEDIA_TYPE: e.MEDIA_TYPES.PLAYLIST,
            UPLOAD_BEGIN_HANDLER: c.uploadBegin,
            UPLOAD_ERROR_HANDLER: j,
            UPLOAD_COMPLETE_HANDLER: i,
            FILE_PROCESSED_SUCCESS_HANDLER: k,
            FILE_PROCESSED_ERROR_HANDLER: h,
            html: {
                filesInput: c.filesInput
            }
        })
    }
    function g(a, e) {
        a && (d = a), b.SetPostParams({
            playlistId: d,
            objectVersion: e ? e : c.playlist.objectVersion
        }), b.StartUpload()
    }
    function h(a, b, e) {
        var f = {};
        f.playlist = {
            playlistId: d
        }, c.executeSerial(f), c.fileProcessFailed(e.errorMessage)
    }
    function i(a, b, e) {
        var f = {};
        f.playlist = {
            playlistId: d,
            objectVersion: e.objectVersion
        }, c.executeSerial(f), c.uploadComplete(e), comm.send("mix.imageChanged", {
            playlistId: d,
            imgs: e.urls,
            objectVersion: e.objectVersion
        })
    }
    function j(a, b, e) {
        var f = {};
        f.playlist = {
            playlistId: d
        }, c.executeSerial(f), c.uploadError(e.errorMessage)
    }
    function k(a, b) {
        if (!window.FileReader) c.autoUpload ? (c.showLoading(), l()) : c.fileAttached(a, b);
        else {
            var d = new FileReader;
            d.onload = function (a) {
                var b = new Image;
                b.src = a.target.result, b.onload = function () {
                    c.autoUpload ? (c.showPreview(a.target.result), l()) : (c.hideLoading(), c.showPreview(a.target.result))
                }
            }, d.readAsDataURL(a), c.showLoading()
        }
    }
    function l() {
        var a = {};
        a.playlistId = c.playlist.playlistId, a.objectVersion = c.playlist.objectVersion, a.changeImage = function (a) {
            g(null, a)
        }, comm.send("mix.changeImage", a)
    }
    var b, c, d, e = Myspace.Upload;
    return {
        init: f,
        startUpload: g
    }
}(jQuery);
(function () {
    $("body").on("click", function (a) {
        $(a.target).closest('a[href="/signout"]').length > 0 && comm.send("signout")
    })
})();